Hello. I need to help becuase I'm really desperate :( :) ..... I'm trying to program the program just same like the drawing software in the window 7, but not completely same xD xD. Unfortunately I have a problem with drawlines....I can't do that. I want to draw line by mouse by e.X and e.Y. I know I should list<Point> but I don't know how to do that. I'm sending some code what I devised.
Somebody to helped me that I should use drawlines and don't use Fillellipse. :( Please, somebody to help me. I'll be very glad.

private void panel1_MouseMove(object sender, MouseEventArgs e)
            {

                if (action2)
                {
                    stetec = new SolidBrush(lbl_color.BackColor);
                    Graphics kp = panel1.CreateGraphics();
                    kp.FillEllipse(stetec, e.X, e.Y, 14, 14);
                    kp.Dispose();
                }
            }

    private void panel1_MouseUp(object sender, MouseEventArgs e)
            {
                action2 = false;

             
            }

    private void panel1_MouseDown(object sender, MouseEventArgs e)
            {
                action2 = true;
            }

    private void panel1_Paint(object sender, PaintEventArgs e)
            {
               
               
            }

This code draws line on mouse move

protected override void OnMouseMove(MouseEventArgs mouseEv)

        { int mouseX = mouseEv.X;
            int mouseY = mouseEv.Y;
            // Create new graphics object
            Graphics gfx = CreateGraphics();
            // Create a pen that has the same background color as the form
            Pen erasePen = new Pen(Color.White);
            // Draw a line that will erase the previous line created
            gfx.DrawLine(erasePen, 0, 0, mouseX, mouseY);
            // Create a pen that will draw the blue line
            Pen linePen = new Pen(Color.Blue);
            gfx.DrawLine(linePen, 0, 0, mouseX, mouseY);
        }

Hi, thank you so much for your code but it's by OnMouseMove...But I can't do that...I can only by Mouse_move....Is it the same ?

use this code like this

void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            this.OnMouseMove(e);
        }
        protected override void OnMouseMove(MouseEventArgs mouseEv)
        {
            int mouseX = mouseEv.X;
            int mouseY = mouseEv.Y;
            // Create new graphics object
            Graphics gfx = CreateGraphics();
            // Create a pen that has the same background color as the form
            Pen erasePen = new Pen(Color.White);
            // Draw a line that will erase the previous line created
            gfx.DrawLine(erasePen, 0, 0, mouseX, mouseY);
            // Create a pen that will draw the blue line
            Pen linePen = new Pen(Color.Blue);
            gfx.DrawLine(linePen, 0, 0, mouseX, mouseY);
        }

and stop drawing line on mouse_up event

Hi, I tryied this code, but it's not what I want. I'm sending the URL where is the picture where is it what I want... http://img.fileup.cz/?di=1013057344774

Thank you so much for your ideas :) ....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.