private void Button_MouseClick(Control sender, MouseEventArgs args) { var colorChooser = new ColorChooser(); colorChooser.Color = Color; if (colorChooser.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Color = colorChooser.Color; if (ColorChanged != null) ColorChanged(this, new EventArgs()); } }
protected override void OnMouseWheel (MouseEventArgs e) { if (vbar == null || !vbar.Visible) return; if (e.Delta < 0) vbar.Value = Math.Min (vbar.Maximum - GetVisibleRowsCount () + 1, vbar.Value + SystemInformation.MouseWheelScrollLines); else vbar.Value = Math.Max (0, vbar.Value - SystemInformation.MouseWheelScrollLines); base.OnMouseWheel (e); }
private static void ChartControl_MouseMove(object sender, MouseEventArgs e) { Chart ptrChart = (Chart)sender; double selX, selY, selX2, selY2; selX = selY = selX2 = selY2 = 0; try { selX = ptrChart.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X); selY = ptrChart.ChartAreas[0].AxisY.PixelPositionToValue(e.Location.Y); selX2 = ptrChart.ChartAreas[0].AxisX2.PixelPositionToValue(e.Location.X); selY2 = ptrChart.ChartAreas[0].AxisY2.PixelPositionToValue(e.Location.Y); if (ChartTool[ptrChart].CursorMovedCallback != null) ChartTool[ptrChart].CursorMovedCallback(selX, selY); } catch (Exception) { /*ToDo: Set coordinate to 0,0 */ return; } //Handle exception when scrolled out of range. switch (ChartTool[ptrChart].ToolState) { case MSChartExtensionToolState.Zoom: #region [ Zoom Control ] if (MouseDowned) { ptrChart.ChartAreas[0].CursorX.SelectionEnd = selX; ptrChart.ChartAreas[0].CursorY.SelectionEnd = selY; } #endregion break; case MSChartExtensionToolState.ZoomX: if (MouseDowned) { ptrChart.ChartAreas[0].CursorX.SelectionEnd = selX; } break; case MSChartExtensionToolState.Pan: #region [ Pan Control ] if (MouseDowned) { //Pan Move - Valid only if view is zoomed if (ptrChart.ChartAreas[0].AxisX.ScaleView.IsZoomed || ptrChart.ChartAreas[0].AxisY.ScaleView.IsZoomed) { double dx = -selX + ptrChart.ChartAreas[0].CursorX.SelectionStart; double dy = -selY + ptrChart.ChartAreas[0].CursorY.SelectionStart; double dx2 = -selX2 + X2Start; double dy2 = -selY2 + Y2Start; double newX = ptrChart.ChartAreas[0].AxisX.ScaleView.Position + dx; double newY = ptrChart.ChartAreas[0].AxisY.ScaleView.Position + dy; double newX2 = ptrChart.ChartAreas[0].AxisX2.ScaleView.Position + dx2; double newY2 = ptrChart.ChartAreas[0].AxisY2.ScaleView.Position + dy2; ptrChart.ChartAreas[0].AxisX.ScaleView.Scroll(newX); ptrChart.ChartAreas[0].AxisY.ScaleView.Scroll(newY); ptrChart.ChartAreas[0].AxisX2.ScaleView.Scroll(newX2); ptrChart.ChartAreas[0].AxisY2.ScaleView.Scroll(newY2); } } #endregion break; } }
public override void MouseButtonUp(MouseEventArgs args) { // Call our parent base.MouseButtonUp(args); // Process our events GuiMouseEventArgs gargs = new GuiMouseEventArgs(); // Translate the mouse buttons if (args.Button == BooGame.Input.MouseButtons.Left || args.Button == BooGame.Input.MouseButtons.None) gargs.Button = MfGames.Sprite3.Gui.MouseButtons.Left; if (args.Button == BooGame.Input.MouseButtons.Right) gargs.Button = MfGames.Sprite3.Gui.MouseButtons.Right; // Fire the event Game.GuiManager.MouseUp(gargs); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); ICalendarSelectableElement hitted = HitTest(e.Location, State == CalendarState.DraggingTimeSelection); CalendarItem hittedItem = hitted as CalendarItem; CalendarDay hittedDay = hitted as CalendarDay; bool shiftPressed = (ModifierKeys & Keys.Shift) == Keys.Shift; switch (State) { case CalendarState.Idle: break; case CalendarState.DraggingTimeSelection: if (SelectedElementStart == null || (hitted != null && !SelectedElementEnd.Equals(hitted))) { SelectedElementEnd = hitted; } if (hittedDay != null) { if (hittedDay.HeaderBounds.Contains(e.Location)) { OnDayHeaderClick(new CalendarDayEventArgs(hittedDay)); } } break; case CalendarState.DraggingItem: if(itemOnStateChanged) OnItemDatesChanged(new CalendarItemEventArgs(itemOnState)); break; case CalendarState.ResizingItem: if (itemOnStateChanged) OnItemDatesChanged(new CalendarItemEventArgs(itemOnState)); break; case CalendarState.EditingItemText: break; } if (itemOnState != null) { itemOnState.SetIsDragging(false); itemOnState.SetIsResizingEndDate(false); itemOnState.SetIsResizingStartDate(false); Invalidate(itemOnState); OnItemClick(new CalendarItemEventArgs(itemOnState)); itemOnState = null; } SetState(CalendarState.Idle); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); ICalendarSelectableElement hitted = HitTest(e.Location); CalendarItem hittedItem = hitted as CalendarItem; bool shiftPressed = (ModifierKeys & Keys.Shift) == Keys.Shift; if (!Focused) { Focus(); } switch (State) { case CalendarState.Idle: if (hittedItem != null) { if (!shiftPressed) ClearSelectedItems(); hittedItem.SetSelected(true); Invalidate(hittedItem); OnItemSelected(new CalendarItemEventArgs(hittedItem)); itemOnState = hittedItem; itemOnStateChanged = false; if (AllowItemEdit) { if (itemOnState.ResizeStartDateZone(e.Location) && AllowItemResize) { SetState(CalendarState.ResizingItem); itemOnState.SetIsResizingStartDate(true); } else if (itemOnState.ResizeEndDateZone(e.Location) && AllowItemResize) { SetState(CalendarState.ResizingItem); itemOnState.SetIsResizingEndDate(true); } else { SetState(CalendarState.DraggingItem); } } SetSelectionRange(null, null); } else { ClearSelectedItems(); if (shiftPressed) { if (hitted != null && SelectedElementEnd == null && !SelectedElementEnd.Equals(hitted)) SelectedElementEnd = hitted; } else { if (SelectedElementStart == null || (hitted != null && !SelectedElementStart.Equals(hitted))) { SetSelectionRange(hitted, hitted); } } SetState(CalendarState.DraggingTimeSelection); } break; case CalendarState.DraggingTimeSelection: break; case CalendarState.DraggingItem: break; case CalendarState.ResizingItem: break; case CalendarState.EditingItemText: break; } }
void OnMouseUp(object sender, MouseEventArgs e) { gotmousedown = false; mousedownpos = new Point(-1, -1); }
void listViewtankinvoice_MouseClick(object sender, MouseEventArgs e) { // go to invoice page ListView dd = (ListView)sender; gototab(dd,0,2,3,1); }
void lsvwStockTanks_MouseClick(object sender, MouseEventArgs e) { ListView dd = (ListView)sender; gototab(dd, 0, 1, 2,1); }
private void listBox_MouseUp (object sender, MouseEventArgs e) { AcceptListBoxSelection (sender); }
protected override void OnMouseWheel(MouseEventArgs e) { base.OnMouseWheel(e); int MAX_DELTA = 120; // basically it's constant now, but could be changed later by MS int multiplier = Math.Abs(e.Delta) / MAX_DELTA; int newValue; if (System.Windows.Forms.SystemInformation.MouseWheelScrollLines > 0) { newValue = this.vScrollBar.Value - (TextEditorProperties.MouseWheelScrollDown ? 1 : -1) * Math.Sign(e.Delta) * System.Windows.Forms.SystemInformation.MouseWheelScrollLines * vScrollBar.SmallChange * multiplier ; } else { newValue = this.vScrollBar.Value - (TextEditorProperties.MouseWheelScrollDown ? 1 : -1) * Math.Sign(e.Delta) * vScrollBar.LargeChange; } vScrollBar.Value = Math.Max(vScrollBar.Minimum, Math.Min(vScrollBar.Maximum, newValue)); }
protected override void OnMouseUp (MouseEventArgs e) { resizing_grid = false; base.OnMouseUp (e); }
protected override void OnMouseDown (MouseEventArgs e) { base.OnMouseDown (e); last_click = e.Location; if (this.RootGridItem == null) return; if (e.X > SplitterLocation - RESIZE_WIDTH && e.X < SplitterLocation + RESIZE_WIDTH) { resizing_grid = true; } else { int offset = -vbar.Value*row_height; GridItem foundItem = GetSelectedGridItem (this.RootGridItem.GridItems, e.Y, ref offset); if (foundItem != null) { if (foundItem.Expandable && ((GridEntry)foundItem).PlusMinusBounds.Contains (e.X, e.Y)) foundItem.Expanded = !foundItem.Expanded; this.SelectedGridItem = (GridEntry)foundItem; if (!GridLabelHitTest (e.X)) { // send mouse down so we get the carret under cursor grid_textbox.SendMouseDown (PointToScreen (e.Location)); } } } }
protected override void OnMouseMove (MouseEventArgs e) { if (this.RootGridItem == null) return; if (resizing_grid) { int loc = Math.Max (e.X,2*V_INDENT); SplitterPercent = 1.0*loc/Width; } if (e.X > SplitterLocation - RESIZE_WIDTH && e.X < SplitterLocation + RESIZE_WIDTH) this.Cursor = Cursors.SizeWE; else this.Cursor = Cursors.Default; base.OnMouseMove (e); }
void TextAreaMouseMove(object sender, MouseEventArgs e) #endif { #if GTK if (gotmousedown == false) { return; } #endif ShowHiddenCursor(); if (dodragdrop) { dodragdrop = false; return; } doubleclick = false; mousepos = new Point((int)args.Event.x, (int)args.Event.y); if (textArea.GutterMargin.DrawingPosition.Contains(mousepos.X, mousepos.Y) || textArea.FoldMargin.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { if (button == 1) { Point realmousepos = textArea.TextView.GetLogicalPosition(0, mousepos.Y /*- textArea.TextView.DrawingPosition.Y*/); if (realmousepos.Y < textArea.Document.TotalNumberOfLines) { if (selectionStartPos.Y == realmousepos.Y) { textArea.SelectionManager.SetSelection(new DefaultSelection(textArea.Document, realmousepos, new Point(textArea.Document.GetLineSegment(realmousepos.Y).Length + 1, realmousepos.Y))); } else if (selectionStartPos.Y < realmousepos.Y && textArea.SelectionManager.HasSomethingSelected) { textArea.SelectionManager.ExtendSelection(textArea.SelectionManager.SelectionCollection[0].EndPosition, realmousepos); } else { textArea.SelectionManager.ExtendSelection(textArea.Caret.Position, realmousepos); } textArea.Caret.Position = realmousepos; } } } else if (textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { if (clickedOnSelectedText) { #if GTK // FIXME: GTKize? if (Math.Abs(mousedownpos.X - mousepos.X) >= 5 || Math.Abs(mousedownpos.Y - mousepos.Y) >= 5) { #else if (Math.Abs(mousedownpos.X - mousepos.X) >= SystemInformation.DragSize.Width / 2 || Math.Abs(mousedownpos.Y - mousepos.Y) >= SystemInformation.DragSize.Height / 2) { #endif clickedOnSelectedText = false; ISelection selection = textArea.SelectionManager.GetSelectionAt(textArea.Caret.Offset); if (selection != null) { string text = selection.SelectedText; if (text != null && text.Length > 0) { #if GTK // FIXME: GTKize #else DataObject dataObject = new DataObject (); dataObject.SetData(DataFormats.UnicodeText, true, text); dataObject.SetData(selection); dodragdrop = true; textArea.DoDragDrop(dataObject, DragDropEffects.All); #endif } } } return; } if (button == 1) { if (gotmousedown) { ExtendSelectionToMouse(); } } } } void ExtendSelectionToMouse() { Point realmousepos = textArea.TextView.GetLogicalPosition(mousepos.X /*- textArea.TextView.DrawingPosition.X*/, mousepos.Y /*- textArea.TextView.DrawingPosition.Y*/); Point oldPos = textArea.Caret.Position; textArea.Caret.Position = realmousepos; textArea.SelectionManager.ExtendSelection(oldPos, textArea.Caret.Position); textArea.SetDesiredColumn(); } Point selectionStartPos = new Point(-1, -1);
void lsvwStock_MouseClick(object sender, MouseEventArgs e) { ListView dd = (ListView)sender; gototab(dd, 0, 2, 3,2); }
void OnMouseDown(object sender, MouseEventArgs e) #endif { if (args.Event.type == Gdk.EventType.TwoButtonPress) { OnDoubleClick(); return; } if (dodragdrop) { return; } if (doubleclick) { doubleclick = false; return; } gotmousedown = true; mousedownpos = new Point((int)args.Event.x, (int)args.Event.y); mousepos = mousedownpos; button = args.Event.button; if (textArea.GutterMargin.DrawingPosition.Contains(mousepos.X, mousepos.Y) || textArea.FoldMargin.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { Point realmousepos = textArea.TextView.GetLogicalPosition(0, mousepos.Y - textArea.TextView.DrawingPosition.Y); if (realmousepos.Y < textArea.Document.TotalNumberOfLines) { selectionStartPos = realmousepos; textArea.SelectionManager.ClearSelection(); textArea.SelectionManager.SetSelection(new DefaultSelection(textArea.Document, realmousepos, new Point(textArea.Document.GetLineSegment(realmousepos.Y).Length + 1, realmousepos.Y))); textArea.Caret.Position = realmousepos; } } else if (textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { if (button == 1) { #if GTK //FIXME: GTKize if (true) { #else if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { ExtendSelectionToMouse(); } else { #endif #if GTK // FIZME: GTKize? Point realmousepos = textArea.TextView.GetLogicalPosition(mousepos.X, mousepos.Y); #else Point realmousepos = textArea.TextView.GetLogicalPosition(mousepos.X - textArea.TextView.DrawingPosition.X, mousepos.Y - textArea.TextView.DrawingPosition.Y); #endif clickedOnSelectedText = false; int offset = textArea.Document.PositionToOffset(realmousepos); if (textArea.SelectionManager.HasSomethingSelected && textArea.SelectionManager.IsSelected(offset)) { clickedOnSelectedText = true; } else { selbegin = selend = offset; textArea.SelectionManager.ClearSelection(); if (mousepos.Y > 0 && mousepos.Y < textArea.TextView.DrawingPosition.Height) { Point pos = new Point(); pos.Y = Math.Min(textArea.Document.TotalNumberOfLines - 1, realmousepos.Y); pos.X = realmousepos.X; textArea.Caret.Position = pos;//Math.Max(0, Math.Min(textArea.Document.TextLength, line.Offset + Math.Min(line.Length, pos.X))); textArea.SetDesiredColumn(); } } } } } #if GTK textArea.GrabFocus(); #else textArea.Focus(); #endif } int FindNext(IDocument document, int offset, char ch) { LineSegment line = document.GetLineSegmentForOffset(offset); int endPos = line.Offset + line.Length; while (offset < endPos && document.GetCharAt(offset) != ch) { ++offset; } return offset; } bool IsSelectableChar(char ch) { return Char.IsLetterOrDigit(ch) || ch=='_'; } int FindWordStart(IDocument document, int offset) { LineSegment line = document.GetLineSegmentForOffset(offset); if (offset > 0 && Char.IsWhiteSpace(document.GetCharAt(offset - 1)) && Char.IsWhiteSpace(document.GetCharAt(offset))) { while (offset > line.Offset && Char.IsWhiteSpace(document.GetCharAt(offset - 1))) { --offset; } } else if (IsSelectableChar(document.GetCharAt(offset)) || (offset > 0 && Char.IsWhiteSpace(document.GetCharAt(offset)) && IsSelectableChar(document.GetCharAt(offset - 1)))) { while (offset > line.Offset && IsSelectableChar(document.GetCharAt(offset - 1))) { --offset; } } else { if (offset > 0 && !Char.IsWhiteSpace(document.GetCharAt(offset - 1)) && !IsSelectableChar(document.GetCharAt(offset - 1)) ) { return Math.Max(0, offset - 1); } } return offset; } int FindWordEnd(IDocument document, int offset) { LineSegment line = document.GetLineSegmentForOffset(offset); int endPos = line.Offset + line.Length; if (IsSelectableChar(document.GetCharAt(offset))) { while (offset < endPos && IsSelectableChar(document.GetCharAt(offset))) { ++offset; } } else if (Char.IsWhiteSpace(document.GetCharAt(offset))) { if (offset > 0 && Char.IsWhiteSpace(document.GetCharAt(offset - 1))) { while (offset < endPos && Char.IsWhiteSpace(document.GetCharAt(offset))) { ++offset; } } } else { return Math.Max(0, offset + 1); } return offset; } void OnDoubleClick() { if (dodragdrop) { return; } doubleclick = true; textArea.SelectionManager.ClearSelection(); if (textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y)) { if (textArea.Caret.Offset < textArea.Document.TextLength) { switch (textArea.Document.GetCharAt(textArea.Caret.Offset)) { case '"': if (textArea.Caret.Offset < textArea.Document.TextLength) { int next = FindNext(textArea.Document, textArea.Caret.Offset + 1, '"'); textArea.SelectionManager.ExtendSelection(textArea.Caret.Position, textArea.Document.OffsetToPosition(next > textArea.Caret.Offset ? next + 1 : next)); } break; default: textArea.SelectionManager.ExtendSelection(textArea.Document.OffsetToPosition(FindWordStart(textArea.Document, textArea.Caret.Offset)), textArea.Document.OffsetToPosition(FindWordEnd(textArea.Document, textArea.Caret.Offset))); break; } // HACK WARNING !!! // must refresh here, because when a error tooltip is showed and the underlined // code is double clicked the textArea don't update corrctly, updateline doesn't // work ... but the refresh does. // Mike #if GTK // FIXME: GTKize #else textArea.Refresh(); #endif } } } }
void lsvwWaitingTanks_MouseClick(object sender, MouseEventArgs e) { ListView dd = (ListView)sender; gototab(dd, 1, 0, 4, 2); }
protected override void OnMouseMove(MouseEventArgs args) { if (Focused == TreeState.Active) { args.ResetPosition = true; args.Handled = true; } }
void CListview_MouseClick(object sender, MouseEventArgs e) { }
protected override void OnMouseDoubleClick(MouseEventArgs e) { base.OnMouseDoubleClick(e); CalendarItem item = ItemAt(e.Location); if (item != null) { OnItemDoubleClick(new CalendarItemEventArgs(item)); } }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); Focus(); _mouseDown = true; MonthViewDay day = HitTest(e.Location); if (day != null) { switch (SelectionMode) { case MonthViewSelection.Manual: case MonthViewSelection.Day: SelectionEnd = _selectionStart = day.Date; break; case MonthViewSelection.WorkWeek: SelectWorkWeek(day.Date); break; case MonthViewSelection.Week: SelectWeek(day.Date); break; case MonthViewSelection.Month: SelectMonth(day.Date); break; } } if (ForwardButtonSelected) { GoForward(); } else if (BackwardButtonSelected) { GoBackward(); } }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); ICalendarSelectableElement hitted = HitTest(e.Location, State != CalendarState.Idle); CalendarItem hittedItem = hitted as CalendarItem; CalendarDayTop hittedTop = hitted as CalendarDayTop; bool shiftPressed = (ModifierKeys & Keys.Shift) == Keys.Shift; if (hitted != null) { switch (State) { case CalendarState.Idle: Cursor should = Cursors.Default; if (hittedItem != null) { if((hittedItem.ResizeEndDateZone(e.Location) || hittedItem.ResizeStartDateZone(e.Location)) && AllowItemResize) { should = hittedItem.IsOnDayTop || DaysMode == CalendarDaysMode.Short ? Cursors.SizeWE : Cursors.SizeNS; } OnItemMouseHover(new CalendarItemEventArgs(hittedItem)); } if (!Cursor.Equals(should)) Cursor = should; break; case CalendarState.DraggingTimeSelection: if (SelectedElementStart != null && !SelectedElementEnd.Equals(hitted)) SelectedElementEnd = hitted; break; case CalendarState.DraggingItem: TimeSpan duration = itemOnState.Duration; itemOnState.SetIsDragging(true); itemOnState.StartDate = hitted.Date; itemOnState.EndDate = itemOnState.StartDate.Add(duration); Renderer.PerformItemsLayout(); Invalidate(); itemOnStateChanged = true; break; case CalendarState.ResizingItem: if (itemOnState.IsResizingEndDate && hitted.Date.CompareTo(itemOnState.StartDate) >= 0) { itemOnState.EndDate = hitted.Date.Add(hittedTop != null || DaysMode == CalendarDaysMode.Short? new TimeSpan(23, 59, 59) : Days[0].TimeUnits[0].Duration ); } else if (itemOnState.IsResizingStartDate && hitted.Date.CompareTo(itemOnState.EndDate) <= 0) { itemOnState.StartDate = hitted.Date; } Renderer.PerformItemsLayout(); Invalidate(); itemOnStateChanged = true; break; case CalendarState.EditingItemText: break; } } }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (_mouseDown) { MonthViewDay day = HitTest(e.Location); if (day != null && day != _lastHitted) { switch (SelectionMode) { case MonthViewSelection.Manual: if (day.Date > SelectionStart) { SelectionEnd = day.Date; } else { SelectionStart = day.Date; } break; case MonthViewSelection.Day: SelectionEnd = _selectionStart = day.Date; break; case MonthViewSelection.WorkWeek: SelectWorkWeek(day.Date); break; case MonthViewSelection.Week: SelectWeek(day.Date); break; case MonthViewSelection.Month: SelectMonth(day.Date); break; } _lastHitted = day; } } if (ForwardButtonBounds.Contains(e.Location)) { SetForwardButtonSelected(true); } else if (ForwardButtonSelected) { SetForwardButtonSelected(false); } if (BackwardButtonBounds.Contains(e.Location)) { SetBackwardButtonSelected(true); } else if (BackwardButtonSelected) { SetBackwardButtonSelected(false); } }
protected override void OnMouseWheel(MouseEventArgs e) { base.OnMouseWheel(e); if (DaysMode == CalendarDaysMode.Expanded) { ScrollTimeUnits(e.Delta); } else if (DaysMode == CalendarDaysMode.Short) { ScrollCalendar(e.Delta); } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); _mouseDown = false; }
private static void ChartControl_MouseDown(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Left) return; Chart ptrChart = (Chart)sender; ChartArea ptrChartArea = ptrChart.ChartAreas[0]; MouseDowned = true; //NOTE: Clicking on the chart in selection mode will draw a cross whether or not the following // code is run (since Cursor.IsUserEnabled is true) // We must set the selection start because it doesn't seem to get // reset automatically (remove the next two lines and zoom a few times to see) Point startAndEndPt = e.Location; const bool roundToBoundary = true; ptrChartArea.CursorX.SetSelectionPixelPosition(startAndEndPt, startAndEndPt, roundToBoundary); ptrChartArea.CursorY.SetSelectionPixelPosition(startAndEndPt, startAndEndPt, roundToBoundary); // What's the diff between CursorPosn and SelectionPosn? X2Start = ptrChartArea.AxisX2.PixelPositionToValue(e.Location.X); Y2Start = ptrChartArea.AxisY2.PixelPositionToValue(e.Location.Y); // Old way //ptrChartArea.CursorX.SelectionStart = ptrChartArea.AxisX.PixelPositionToValue(e.Location.X); //ptrChartArea.CursorY.SelectionStart = ptrChartArea.AxisY.PixelPositionToValue(e.Location.Y); //ptrChartArea.CursorX.SelectionEnd = ptrChartArea.CursorX.SelectionStart; //ptrChartArea.CursorY.SelectionEnd = ptrChartArea.CursorY.SelectionStart; ChartData chartData = GetDataForChart(ptrChart); if (chartData.SelectionChangedCallback != null) { // If we use Position, there's no need to set/get the Selection chartData.SelectionChangedCallback( ptrChartArea.CursorX.Position, ptrChartArea.CursorY.Position); } }
protected override void OnMouseWheel(MouseEventArgs e) { base.OnMouseWheel(e); if (e.Delta < 0) { GoForward(); } else { GoBackward(); } }
private static void ChartControl_MouseUp(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Left) return; MouseDowned = false; Chart ptrChart = (Chart)sender; ChartArea ptrChartArea = ptrChart.ChartAreas[0]; ChartData data = GetDataForChart(ptrChart); MSChartExtensionToolState state = data.ToolState; switch (state) { case MSChartExtensionToolState.Zoom: case MSChartExtensionToolState.ZoomX: //Zoom area (Pixel) double XStart = ptrChartArea.CursorX.SelectionStart; double XEnd = ptrChartArea.CursorX.SelectionEnd; double YStart = ptrChartArea.CursorY.SelectionStart; double YEnd = ptrChartArea.CursorY.SelectionEnd; if ((XStart == XEnd) && (YStart == YEnd)) return; //Zoom area for X Axis double left = Math.Min(XStart, XEnd); double right = Math.Max(XStart, XEnd); double XMin = ptrChartArea.AxisX.ValueToPosition(left); double XMax = ptrChartArea.AxisX.ValueToPosition(right); //Zoom area for Y Axis double bottom = Math.Min(YStart, YEnd); double top = Math.Max(YStart, YEnd); double YMin = ptrChartArea.AxisY.ValueToPosition(bottom); double YMax = ptrChartArea.AxisY.ValueToPosition(top); // NOTE: left <= right, even if Axis.IsReversed //X-Axis ptrChartArea.AxisX.ScaleView.Zoom(left, right); ptrChartArea.AxisX2.ScaleView.Zoom( ptrChartArea.AxisX2.PositionToValue(XMin), ptrChartArea.AxisX2.PositionToValue(XMax)); //Y-Axis if (state == MSChartExtensionToolState.Zoom) { ptrChartArea.AxisY.ScaleView.Zoom(bottom, top); ptrChartArea.AxisY2.ScaleView.Zoom( ptrChartArea.AxisY2.PositionToValue(YMin), ptrChartArea.AxisY2.PositionToValue(YMax)); } //Clear selection (the following seem to be equivalent) ptrChartArea.CursorX.SetSelectionPosition(0, 0); ptrChartArea.CursorY.SetSelectionPosition(0, 0); //ptrChartArea.CursorX.SelectionStart = ptrChartArea.CursorX.SelectionEnd; //ptrChartArea.CursorY.SelectionStart = ptrChartArea.CursorY.SelectionEnd; //NOTE: At this point, the scaled view has already been updated to reflect zoom OnZoomChanged(ptrChart); break; case MSChartExtensionToolState.Pan: break; } }
internal void OnRightClick(MouseEventArgs objMouseEventArgs) { Gizmox.WebGUI.Forms.ContextMenu contextMenu = this.ContextMenu; if (contextMenu != null) { contextMenu.Show(this.Owner, this, new Point(objMouseEventArgs.X, objMouseEventArgs.Y), DialogAlignment.Custom); } }