私の意見では、解決策は 2 つあります。1 つ目は、波形ビットマップを自分でコントロールにペイントすることです (したがって、使用可能なスペースをすべて使用しますが、ビットマップを多少引き伸ばします)。2 つ目は、コントロールの周りにいくつかのパネルを構築し、それに応じてサイズを変更することです (グラフは常に正しい縦横比で表示されますが、画面スペースが無駄になり、より複雑になります)。
1 zedgraph の仕組みはわかりませんが、以下を提案します。あなたが書いていることから、それはユーザーコントロールです。私がすることは、その onPaint メソッドを聞くことです。コントロール上に何でも (ビットマップを含む) 描画するために自由に使用できるグラフィックス オブジェクトが与えられます。コントロールのサイズを参照すると、対応する縦横比でビットマップを簡単に描画できます。
2
グラフ コントロールを保持するコンテナを作成し、上下左右に 1 つずつ、計 4 つのパネルを追加します。この画像のように:

必要な縦横比に応じてこれらのサイズを変更できるようになりました。そのためには、ResizeEnd イベント (ユーザーがコントロールのサイズ変更を終了するたびに呼び出される) と、フォームが最大化された場合にリッスンするイベント ( example ) の 2 つのイベントをリッスンする必要があります。実行する必要があるコードは次のとおりです。
private void AdjustPanels(object sender, EventArgs e)
{
double desiredAspectRatio = 1;
// I am using the form itself as a reference to the size and aspect ration of the application.
// you can, of course, use any other control instead (e.g. a panel where you stuff all the other panels
int width = this.Width;
int height = this.Height;
double formAspectRatio = (double)width / (double)height;
int marginLeft=0, marginRight=0, marginTop=0, marginBottom=0;
if (desiredAspectRatio > formAspectRatio)
{
// high aspect ratios mean a wider picture -> the picture we want is wider than what it currently is
// so we will need a margin on top and bottom
marginLeft = 0; marginRight = 0;
marginTop = (int)((height - desiredAspectRatio * width) / 2);
marginBottom = (int)((height - desiredAspectRatio * width) / 2);
}
else
{
marginTop = 0; marginBottom = 0;
marginLeft = (int)((width - desiredAspectRatio*height)/2);
marginRight = (int)((width - desiredAspectRatio * height) / 2);
}
pnlTop.Height = marginTop;
pnlBottom.Height = marginBottom;
pnlLeft.Width = marginLeft;
pnlRight.Width = marginRight;
}
もちろん、「desiredAspectRation」の値を波形画像の縦横比に置き換える必要があります。さらにサポートが必要な場合は、プライベート メッセージであなたのメール アドレスをお知らせください。完全な Visual Studio ソリューションをお送りします。