我遇到了PictureBox
不同分辨率之间大小不同的问题。
我有一个需要适应的图像PictureBox
,但我需要知道它的绘图大小,因为我需要自己调整大小(否则系统太慢了,我决定手动调整大小,这如果我知道所需的分辨率,效果很好)。
我试过PictureBox.Height / Width
和PictureBox.ClientRectangle.Height / Width
,但所有分辨率的值都是相同的。我如何设法获得实际的图纸尺寸?
初始化代码:
//
// PicboxRed
//
this.PicboxRed.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PicboxRed.BackColor = System.Drawing.Color.DimGray;
this.PicboxRed.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.PicboxRed.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.PicboxRed.Location = new System.Drawing.Point(19, 92);
this.PicboxRed.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.PicboxRed.Name = "PicboxRed";
this.PicboxRed.Size = new System.Drawing.Size(852, 840);
this.PicboxRed.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Normal;
this.PicboxRed.TabIndex = 9;
this.PicboxRed.TabStop = false;
this.PicboxRed.Click += new System.EventHandler(this.PicboxRed_Click);
this.PicboxRed.Paint += new System.Windows.Forms.PaintEventHandler(this.Picbox_Paint);
我知道这与设置的锚点有关,但这可以让 PictureBox 在不同的分辨率下被很好地看到。我如何抓住那个真正的绘图区域?