antfu / live-draw

A tool allows you to draw on screen real-time.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve movement of ui

thALaZy opened this issue · comments

when I try to move the ui it stops after about 10 ms here is a video but I have some c# code so it's way smoother:
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;

    [DllImport("user32.dll")]
    public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

    [DllImport("user32.dll")]
    public static extern bool ReleaseCapture();

    private void FormMoveable_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
        {
            ReleaseCapture();
            SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
        }
    }
2021-01-11.13-31-24.mp4

This lag happens when we try to drag the window after clicking on "Release/Recover the control of drawing" (above a certain speed). Otherwise its smooth.