static LRESULT CallDefaultProcedure(WindowHandle window, WindowMessage message, WPARAM wParam, LPARAM lParam) { return(WindowMethods.DefaultWindowProcedure(window, message, wParam, lParam)); }
static LRESULT WindowProcedure(WindowHandle window, WindowMessage message, WPARAM wParam, LPARAM lParam) { switch (message) { case WindowMessage.Size: int cxClient = lParam.LowWord; int cyClient = lParam.HighWord; apt[0].x = cxClient / 4; apt[0].y = cyClient / 2; apt[1].x = cxClient / 2; apt[1].y = cyClient / 4; apt[2].x = cxClient / 2; apt[2].y = 3 * cyClient / 4; apt[3].x = 3 * cxClient / 4; apt[3].y = cyClient / 2; return(0); case WindowMessage.LeftButtonDown: case WindowMessage.RightButtonDown: case WindowMessage.MouseMove: MouseKey mk = (MouseKey)wParam.LowWord; if ((mk & (MouseKey.LeftButton | MouseKey.RightButton)) != 0) { using (DeviceContext dc = window.GetDeviceContext()) { dc.SelectObject(StockPen.White); DrawBezier(dc, apt); if ((mk & MouseKey.LeftButton) != 0) { apt[1].x = lParam.LowWord; apt[1].y = lParam.HighWord; } if ((mk & MouseKey.RightButton) != 0) { apt[2].x = lParam.LowWord; apt[2].y = lParam.HighWord; } dc.SelectObject(StockPen.Black); DrawBezier(dc, apt); } } return(0); case WindowMessage.Paint: window.Invalidate(true); using (DeviceContext dc = window.BeginPaint()) { DrawBezier(dc, apt); } return(0); case WindowMessage.Destroy: WindowMethods.PostQuitMessage(0); return(0); } return(WindowMethods.DefaultWindowProcedure(window, message, wParam, lParam)); }