how can i use a pen, on paint program, without broken the line?

heres my code for draw a line when i do mouse down:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
a.Paint=[](HDC ImageWindow)
    {

        static image imgtest2(a.width, a.height);
        //imgtest.draw(imgtest2);
        imgtest2.Brush(RGB(0,255,0));
        pen pna(PS_SOLID,10,RGB(255,0,0));
        imgtest2.Pen(pna);
        if(blnRightMouseButtonDown==true)
            imgtest2.DrawLine(lastmousecoordenates.x,lastmousecoordenates.y,mousecoordenates.x,mousecoordenates.y);

        imgtest2.draw(ImageWindow);
        GetCursorPos(&mousecoordenates);
        ScreenToClient(a,&mousecoordenates);
    };

    //when i click on left button
    a.MouseMove=[](MouseButtons Button, bool control, bool shift, int x, int y)
    {
        if(Button == MouseButtons::Left)
        {
            blnRightMouseButtonDown=true;
            GetCursorPos(&lastmousecoordenates);
            ScreenToClient(a,&lastmousecoordenates);
            a.Refresh();
        }
    };

    a.MouseUp=[](MouseButtons Button, bool control, bool shift, int x, int y)
    {
        blnRightMouseButtonDown=false;

    };

maybe i miss something with mouse coordenates. but sometimes, depending on mouse speed moving, i only see dots. what anyone can advice me for draw lines without broken them?
Topic archived. No new replies allowed.