//private GraphicsPath CreateRoundedFormRect(bool correction) //{ // Rectangle rect = new Rectangle(Point.Empty, this.Size); // return GraphicsPathHelper.CreateRoundedRect(rect, Radius, Round, correction); //} /// <summary> /// 判断所接收到的 wm_nc-calc-size 消息是否指示窗体即将最小化 /// </summary> private bool IsAboutToMinimize(WinAPI.RECT rect) { if(rect.Left == -32000 && rect.Top == -32000) return true; else return false; }
/// <summary> /// 判断所接收到的 wm_nc-calc-size 消息是否指示窗体即将最大化 /// </summary> private bool IsAboutToMaximize(WinAPI.RECT rect) { /* * 判断的方法是,只要窗体的左右、上下都延伸到了屏幕工作区之外, * 并且左和右、上和下都延伸相同的量,就认为窗体是要进行最大化 */ int left = rect.Left; int top = rect.Top; int width = rect.Right - rect.Left; int height = rect.Bottom - rect.Top; if (left < 0 && top < 0) { Rectangle workingArea = Screen.GetWorkingArea(this); if (width == (workingArea.Width + (-left) * 2) && height == (workingArea.Height + (-top) * 2)) return true; } return false; }