1
Answer

C# drawing lines and moving them

ilhami caliskan

ilhami caliskan

11y
2.9k
1

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)