/// <summary> /// Overrides, when click on, handles color selection. /// </summary> /// <param name="e"></param> protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); // Check cursor, if on one of the buttons - hot track it for (int recIndex = 0; recIndex < buttons.Length; recIndex++) { if (buttons[recIndex].Contains(e.Location)) { mCurrentSelected = recIndex; // More mSelectableWidths - open dialog if (mCurrentSelected == 5) { LineWidth = OpenMoreLinesDialog(); } else { LineWidth = CustomLineWeights.SelectableLineWeights[recIndex]; lineWidthTip.SetToolTip(this, CustomLineWeights.SelectableLineWeights[recIndex].ToString()); } if (mContextForm != null) { mContextForm.Hide(); } mContextForm = null; } } this.Refresh(); }
/// <summary> /// Open the 'More Weights' dialog, that is, a normal ColorDialog control. /// </summary> /// <returns></returns> private float OpenMoreLinesDialog() { mLineWidthDialog.LineWidth = LineWidth; Form parentForm = this.FindForm(); ContextMenuForm contextFrm = parentForm as ContextMenuForm; if (contextFrm != null) { // Ignore lost focus events on owner context menu form contextFrm.Locked = true; mLineWidthDialog.ShowDialog(contextFrm); // Give the focus back to owner form if (mParentControl != null) { mParentControl.FindForm().BringToFront(); } // Active lost focus events on owner context menu form contextFrm.Locked = false; } else { mLineWidthDialog.ShowDialog(this); // (parentForm); } return(mLineWidthDialog.LineWidth); }
/// <summary> /// Overrides, when click on, handles color selection. /// </summary> /// <param name="e"></param> protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); // Check cursor, if on one of the buttons - hot track it for (int recIndex = 0; recIndex < buttons.Length; recIndex++) { if (buttons[recIndex].Contains(e.Location)) { mCurrentSelected = recIndex; //if a custom cap is choosen we need to set the CustomLineCap if (CustomCaps.SelectableLineCaps[recIndex] == ConnectionCap.Generalization) { mCustomLineCap = generalizationCap; } else { mCustomLineCap = null; } LineCap = CustomCaps.SelectableLineCaps[recIndex]; lineWidthTip.SetToolTip(this, CustomCaps.SelectableLineCaps[recIndex].ToString()); if (mContextForm != null) { mContextForm.Hide(); } mContextForm = null; } } this.Refresh(); }
/// <summary> /// Opens the control inside a context menu in the specified location /// </summary> /// <param name="startLocation">Screen coordinates location of the control</param> public void Show(Point startLocation) { // Creates new contextmenu form, adds the control to it, display it. mContextForm = new ContextMenuForm(); mContextForm.SetContainingControl(this); mContextForm.Height = OfficeLineWidthPicker.PreferredHeight; mContextForm.Show(this, startLocation, OfficeLineWidthPicker.PreferredWidth); }
/// <summary> /// Opens the control inside a context menu in the specified location /// </summary> /// <param name="startLocation">Screen coordinates location of the control</param> /// <param name="parent">Parent control to place the control at</param> public void Show(Control parent, Point startLocation) { mParentControl = parent; // Creates new contextmenu form, adds the control to it, display it. ContextMenuForm frm = new ContextMenuForm(); frm.SetContainingControl(this); frm.Height = OfficeLineWidthPicker.PreferredHeight; mContextForm = frm; frm.Show(parent, startLocation, OfficeLineWidthPicker.PreferredWidth); }
/// <summary> /// Overrides, when click on, handles color selection. /// </summary> /// <param name="e"></param> protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); // Check cursor, if on one of the buttons - hot track it for (int recIndex = 0; recIndex < buttons.Length; recIndex++) { if (buttons[recIndex].Contains(e.Location)) { mCurrentSelected = recIndex; //if a custom cap is choosen we need to set the CustomLineCap if (CustomCaps.SelectableLineCaps[recIndex] == ConnectionCap.Generalization) mCustomLineCap = generalizationCap; else mCustomLineCap = null; LineCap = CustomCaps.SelectableLineCaps[recIndex]; lineWidthTip.SetToolTip(this, CustomCaps.SelectableLineCaps[recIndex].ToString()); if (mContextForm != null) mContextForm.Hide(); mContextForm = null; } } this.Refresh(); }
/// <summary> /// Opens the control inside a context menu in the specified location /// </summary> /// <param name="startLocation">Screen coordinates location of the control</param> /// <param name="parent">Parent control to place the control at</param> public void Show(Control parent, Point startLocation) { mParentControl = parent; // Creates new contextmenu form, adds the control to it, display it. ContextMenuForm frm = new ContextMenuForm(); frm.SetContainingControl(this); frm.Height = OfficeLineCapPicker.PreferredHeight; mContextForm = frm; frm.Show(parent, startLocation, OfficeLineCapPicker.PreferredWidth); }
/// <summary> /// Opens the control inside a context menu in the specified location /// </summary> /// <param name="startLocation">Screen coordinates location of the control</param> public void Show(Point startLocation) { // Creates new contextmenu form, adds the control to it, display it. mContextForm = new ContextMenuForm(); mContextForm.SetContainingControl(this); mContextForm.Height = OfficeLineCapPicker.PreferredHeight; mContextForm.Show(this, startLocation, OfficeLineCapPicker.PreferredWidth); }
/// <summary> /// Overrides, when click on, handles color selection. /// </summary> /// <param name="e"></param> protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); // Check cursor, if on one of the buttons - hot track it for (int recIndex = 0; recIndex < buttons.Length; recIndex++) { if (buttons[recIndex].Contains(e.Location)) { mCurrentSelected = recIndex; // More mSelectableWidths - open dialog if (mCurrentSelected == 5) { LineWidth = OpenMoreLinesDialog(); } else { LineWidth = CustomLineWeights.SelectableLineWeights[recIndex]; lineWidthTip.SetToolTip(this, CustomLineWeights.SelectableLineWeights[recIndex].ToString()); } if (mContextForm != null) mContextForm.Hide(); mContextForm = null; } } this.Refresh(); }