ilhami caliskan

ilhami caliskan

  • NA
  • 76
  • 89.3k

C# drawing lines and moving them

Oct 15 2013 11:00 AM

Dear All,
I'm drawing a line this way to my Form

public void DrawLine(int x1, int y1, int x2, int y2)
        {
            System.Drawing.Pen myPen;
            myPen = new System.Drawing.Pen((System.Drawing.Color.Red),10);
            System.Drawing.Graphics line = this.CreateGraphics();
            line.DrawLine(myPen, x1,y1,x2,y2);
           
            myPen.Dispose();
            line.Dispose();
        }

But I need to handle this line like an object which I can move with position coordinates.
in one form sometimes I have to draw several lines and according to calculated positions I have to move these lines.
What is your suggestion how to do it?
redraw all lines again when position is changed? or is there any way to handle it like an object. Maybe handling through a controller?
Thanx for your Ideas...


Answers (1)