在我的表单加载中,我有这个:
private void PrintingDesignForm_Load(object sender, System.EventArgs e) {
int formWidth = this.Width; //300
int formHeight = this.Height; //300
decimal rectWidth = 1000;
decimal rectHeight = 800;
// Code to scale down rectangle
this.Paint += (se, pe) => {
var r = new Rectangle(0, 0, (int)Math.Floor(rectWidth), (int)Math.Floor(rectHeight));
var brush = new SolidBrush(Color.FromArgb(255, 255, 204));
pe.Graphics.FillRectangle(brush, r);
using (var pen = new Pen(brush.Color, 2))
pe.Graphics.DrawRectangle(pen, r);
};
}
我正在尝试调整矩形的大小,以使其与矩形大小成比例。
我该怎么做?