2013-03-16 76 views

回答

1

您可以使用指定x,y,寬度和高度的構造函數Rectangle(int,int,int,int)來創建新的Rectangle。 因此,使用先前的Rectangle的x + 10,y,width,height作爲參數。

Rectangle newRect = new Rectangle(
    pictureBox1.Location.X + 10, 
    pictureBox1.Location.Y, 
    pictureBox1.Width, 
    pictureBox1.Heigth); 
0

就像這樣。是否從我的頭頂開始,這樣可能會出現一些錯誤的屬性。

Pen pen = new Pen(Color.FromArgb(255, 0, 0, 0), 1); 
e.Graphics.DrawRectangle(
    blackPen, 
    pictureBox1.Location.X + 10, 
    pictureBox1.Location.Y, 
    pictureBox1.Size.Width, 
    pictureBox1.Size.Heigth); 

(JustGoogleIt)

相關問題