how can i move a rectangular from one position to another
-
i have already draw many rectangle inside a form how can i move the rectangular form one position to another after i have selected the rectangular to move.
You can do this by changing the Rectangle Draw points and then redraw the object.
Rectangle DrawRectangle = new Rectangle(4,4,50,50); private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { e.Graphics.DrawRectangle(System.Drawing.Pens.Beige, DrawRectangle); } private void button1_Click(object sender, System.EventArgs e) { DrawRectangle = new Rectangle(20,20,50,50); panel1.Invalidate(); }
-
You can do this by changing the Rectangle Draw points and then redraw the object.
Rectangle DrawRectangle = new Rectangle(4,4,50,50); private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { e.Graphics.DrawRectangle(System.Drawing.Pens.Beige, DrawRectangle); } private void button1_Click(object sender, System.EventArgs e) { DrawRectangle = new Rectangle(20,20,50,50); panel1.Invalidate(); }
thanx for your tips.i want to ask i have a lot of rectangle in the form how can i know which rectangle i have select to move and can i remain the size of the rectangle when i move and can i see the effect of the move when i move the rectangle.thank you for help me answer the question.