public FigureResize(SimpleFigures ownerControl, ResizeLocation location) { InitializeComponent(); this.ownerControl = ownerControl; this.ownerControl.canvas.Children.Add(this); this.location = location; this.Width = 20; this.Height = 20; PositionSetUp(); }
public FigureResize(SimpleFigures ownerControl, ResizeLocation location) { InitializeComponent(); this.ownerControl = ownerControl; this.ownerControl.Controls.Add(this); this.ownerControl.Controls[this.ownerControl.Controls.Count - 1].BringToFront(); this.location = location; this.Size = new Size(20, 20); PositionSetUp(); }
private void titlebar_MouseDown(object sender, MouseEventArgs e) { //a shared MouseDown function(titleCaption,title bar, sizing edges). //Retrieves the form's current location on the screen. loc = e.Location; theWidth = this.Width; pright = this.Right; pbottom = this.Bottom; Cursor.Clip = Screen.PrimaryScreen.WorkingArea; //For the resizing edges... try { Panel panel = (Panel)sender; switch (panel.Name) { case "toppnl": rLoc = ResizeLocation.top; break; case "leftpnl": rLoc = ResizeLocation.left; break; case "leftpnl2": rLoc = ResizeLocation.left; break; case "rightpnl": rLoc = ResizeLocation.right; break; case "rightpnl2": rLoc = ResizeLocation.right; break; case "bottompnl": rLoc = ResizeLocation.bottom; break; case "bottompnl2": rLoc = ResizeLocation.bottom; break; case "nwsize": rLoc = ResizeLocation.bottomleft; break; case "swresize": rLoc = ResizeLocation.bottomright; break; } } catch { } }
private void resize(ResizeLocation e) { //The resize function using the Windows API (SendMessage() and ReleaseCapture()). int dir = -1; switch (e) { case ResizeLocation.top: dir = HTTOP; break; case ResizeLocation.left: dir = HTLEFT; break; case ResizeLocation.right: dir = HTRIGHT; break; case ResizeLocation.bottom: dir = HTBOTTOM; break; case ResizeLocation.bottomleft: dir = HTBOTTOMLEFT; break; case ResizeLocation.bottomright: dir = HTBOTTOMRIGHT; break; } if (dir != -1) { API.ReleaseCapture(); API.SendMessage(this.Handle, WM_NCLBUTTONDOWN, dir, 0); } }
private void titlebar_MouseDown(object sender, MouseEventArgs e) { //a shared MouseDown function(titleCaption,title bar, sizing edges). //Retrieves the form's current location on the screen. loc = e.Location; theWidth = this.Width; pright = this.Right; pbottom = this.Bottom; Cursor.Clip = Screen.PrimaryScreen.WorkingArea; //For the resizing edges... try { Panel panel = (Panel)sender; switch (panel.Name) { case "toppnl": rLoc = ResizeLocation.top; break; case "leftpnl": rLoc = ResizeLocation.left; break; case "leftpnl2": rLoc = ResizeLocation.left; break; case "rightpnl": rLoc = ResizeLocation.right; break; case "rightpnl2": rLoc = ResizeLocation.right; break; case "bottompnl": rLoc = ResizeLocation.bottom; break; case "bottompnl2": rLoc = ResizeLocation.bottom; break; case "nwsize": rLoc = ResizeLocation.bottomleft; break; case "swresize": rLoc = ResizeLocation.bottomright; break; } } catch {} }