/// <summary> /// Event Handle from MouseMove event /// </summary> /// <param name="sender">The control that raised the event.</param> /// <param name="e">The event arguments.</param> private void pnlDrawingArea_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { // If the user has selected to draw a zoom rectangle and has a mouse // button pressed down, update the zoom rectangle end point to the // new mouse location. if ((miZoomToRect.Checked) && (MouseButtons != MouseButtons.None)) { // Erase the previous zoom rectangle Rectangle screenRect = zoomRectangle; screenRect.Offset(pnlDrawingArea.PointToScreen(Point.Empty)); ControlPaint.DrawReversibleFrame(screenRect, Color.Transparent, FrameStyle.Dashed); int xSize = e.X - zoomRectangle.Location.X; int ySize = e.Y - zoomRectangle.Location.Y; int zoomRectSize = Math.Max(Math.Abs(xSize), Math.Abs(ySize)); zoomRectangle.Width = (xSize > 0)?zoomRectSize:-zoomRectSize; zoomRectangle.Height = (ySize > 0)?zoomRectSize:-zoomRectSize; // Draw the current zoom rectangle screenRect = zoomRectangle; screenRect.Offset(pnlDrawingArea.PointToScreen(Point.Empty)); ControlPaint.DrawReversibleFrame(screenRect, Color.Transparent, FrameStyle.Dashed); } }
private void pnlLog_MouseMove(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { pnlLog.Width = this.Width - this.PointToClient(pnlLog.PointToScreen(e.Location)).X; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void MouseHoverControlHover(object sender, EventArgs e) { object label = OnHoverRectangle(iMouseHoverControl.HoverPosition); iToolTip.Text = (string)label; iToolTip.Hide(); iToolTip.Show(iPanel.PointToScreen(iMouseHoverControl.HoverPosition)); }
private void ShowPanelFlaps(Panel panel) { Point panelPos = dockManager.PointToClient (panel.PointToScreen (new Point (0))); Point [] flapPos = { //flap positions are a cross shape in the center of the target panel new Point (panelPos.X + (panel.Width - flapSize) / 2, panelPos.Y + (panel.Height - flapSize) / 2 - flapSize - 5), new Point (panelPos.X + (panel.Width - flapSize) / 2, panelPos.Y + (panel.Height - flapSize) / 2 + flapSize + 5), new Point (panelPos.X + (panel.Width - flapSize) / 2 - flapSize - 5, panelPos.Y + (panel.Height - flapSize) / 2), new Point (panelPos.X + (panel.Width - flapSize) / 2 + flapSize + 5, panelPos.Y + (panel.Height - flapSize) / 2), new Point (panelPos.X + (panel.Width - flapSize) / 2, panelPos.Y + (panel.Height - flapSize) / 2), }; for (int i = 0; i < 5; i++) { flaps [i].Location = flapPos [i]; flaps [i].Show (); } }