nint _WndProc(wnd w, int msg, nint wParam, nint lParam) { //WndUtil.PrintMsg(w, msg, wParam, lParam); switch (msg) { case Api.WM_NCDESTROY: _img.Dispose(); _cursor?.Dispose(); if (_w != default) { _w = default; _w.Post(Api.WM_APP); } break; case Api.WM_SETCURSOR: Api.SetCursor(_cursor.Handle); return(1); case Api.WM_ERASEBKGND: return(default); case Api.WM_PAINT: var dc = Api.BeginPaint(w, out var ps); _WmPaint(dc); Api.EndPaint(w, ps); return(default); case Api.WM_MOUSEMOVE: _WmMousemove(Math2.NintToPOINT(lParam)); break; case Api.WM_LBUTTONDOWN: _WmLbuttondown(Math2.NintToPOINT(lParam)); break; } return(Api.DefWindowProc(w, msg, wParam, lParam)); }