private void ResizeForm(ResizeDirection direction) { if (!base.DesignMode) { int num = -1; switch (direction) { case ResizeDirection.BottomLeft: num = 16; break; case ResizeDirection.Left: num = 10; break; case ResizeDirection.Right: num = 11; break; case ResizeDirection.BottomRight: num = 17; break; case ResizeDirection.Bottom: num = 15; break; } MaterialForm.ReleaseCapture(); if (num != -1) { MaterialForm.SendMessage(base.Handle, 161, num, 0); } } }
protected override void WndProc(ref Message m) { base.WndProc(ref m); if (!base.DesignMode && !base.IsDisposed) { Point position; if (m.Msg == 515) { this.MaximizeWindow(!this._maximized); } else if (m.Msg == 512 && this._maximized && (this._statusBarBounds.Contains(base.PointToClient(Cursor.Position))) && !this._minButtonBounds.Contains(base.PointToClient(Cursor.Position)) && !this._maxButtonBounds.Contains(base.PointToClient(Cursor.Position)) && !this._xButtonBounds.Contains(base.PointToClient(Cursor.Position))) { if (this._headerMouseDown) { this._maximized = false; this._headerMouseDown = false; Point point = base.PointToClient(Cursor.Position); if (point.X < base.Width / 2) { object location; if (point.X >= this._previousSize.Width / 2) { position = Cursor.Position; int x = position.X - this._previousSize.Width / 2; position = Cursor.Position; location = new Point(x, position.Y - point.Y); } else { position = Cursor.Position; int x2 = position.X - point.X; position = Cursor.Position; location = new Point(x2, position.Y - point.Y); } base.Location = (Point)location; } else { object location2; if (base.Width - point.X >= this._previousSize.Width / 2) { position = Cursor.Position; int x3 = position.X - this._previousSize.Width / 2; position = Cursor.Position; location2 = new Point(x3, position.Y - point.Y); } else { position = Cursor.Position; int x4 = position.X - this._previousSize.Width + base.Width - point.X; position = Cursor.Position; location2 = new Point(x4, position.Y - point.Y); } base.Location = (Point)location2; } base.Size = this._previousSize; MaterialForm.ReleaseCapture(); MaterialForm.SendMessage(base.Handle, 161, 2, 0); } } else if (m.Msg == 513 && (this._statusBarBounds.Contains(base.PointToClient(Cursor.Position))) && !this._minButtonBounds.Contains(base.PointToClient(Cursor.Position)) && !this._maxButtonBounds.Contains(base.PointToClient(Cursor.Position)) && !this._xButtonBounds.Contains(base.PointToClient(Cursor.Position))) { if (!this._maximized) { MaterialForm.ReleaseCapture(); MaterialForm.SendMessage(base.Handle, 161, 2, 0); } else { this._headerMouseDown = true; } } else if (m.Msg == 516) { Point pt = base.PointToClient(Cursor.Position); if (this._statusBarBounds.Contains(pt) && !this._minButtonBounds.Contains(pt) && !this._maxButtonBounds.Contains(pt) && !this._xButtonBounds.Contains(pt)) { IntPtr systemMenu = MaterialForm.GetSystemMenu(base.Handle, false); position = Cursor.Position; int x5 = position.X; position = Cursor.Position; int wParam = MaterialForm.TrackPopupMenuEx(systemMenu, 256u, x5, position.Y, base.Handle, IntPtr.Zero); MaterialForm.SendMessage(base.Handle, 274, wParam, 0); } } else if (m.Msg == 161) { if (this.Sizable) { byte b = 0; if (this._resizingLocationsToCmd.ContainsKey((int)m.WParam)) { b = (byte)this._resizingLocationsToCmd[(int)m.WParam]; } if (b != 0) { MaterialForm.SendMessage(base.Handle, 274, 0xF000 | b, (int)m.LParam); } } } else if (m.Msg == 514) { this._headerMouseDown = false; } } }