private Color OpenTransparencyDialog() { gView.Framework.Symbology.UI.FormColorTransparency dlg = new gView.Framework.Symbology.UI.FormColorTransparency(Color); Form parentForm = this.FindForm(); ContextMenuForm contextFrm = parentForm as ContextMenuForm; if (contextFrm != null) { // Ignore lost focus events on owner context menu form contextFrm.Locked = true; dlg.ShowDialog(contextFrm); // Give the focus back to owner form if (_parentControl != null) { _parentControl.FindForm().BringToFront(); } // Active lost focus events on owner context menu form contextFrm.Locked = false; } else { dlg.ShowDialog(this); } return(dlg.Color); }
/// <summary> /// Open the 'More Color' dialog, that is, a normal ColorDialog control. /// </summary> /// <returns></returns> private Color OpenMoreColorsDialog() { colorDialog.Color = Color; Form parentForm = this.FindForm(); ContextMenuForm contextFrm = parentForm as ContextMenuForm; if (contextFrm != null) { // Ignore lost focus events on owner context menu form contextFrm.Locked = true; colorDialog.ShowDialog(contextFrm); // Give the focus back to owner form if (_parentControl != null) { _parentControl.FindForm().BringToFront(); } // Active lost focus events on owner context menu form contextFrm.Locked = false; } else { colorDialog.ShowDialog(this); // (parentForm); } return(colorDialog.Color); }
/// <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. _contextForm = new ContextMenuForm(); _contextForm.SetContainingControl(this); _contextForm.Height = PreferredHeight; _contextForm.Show(this, startLocation, PreferredWidth); }
public void Show(Control parent, Point startLocation) { _parentControl = parent; // Creates new contextmenu form, adds the control to it, display it. ContextMenuForm frm = new ContextMenuForm(); frm.SetContainingControl(this); frm.Height = PreferredHeight; _contextForm = frm; frm.Show(parent, startLocation, PreferredWidth); }
protected override void OnMouseClick(MouseEventArgs e) { if (_selectedIndex != -1) { if (DashStyleSelected != null) { DashStyleSelected(this, EventArgs.Empty); } } if (_contextForm != null) { _contextForm.Hide(); } _contextForm = null; }
protected override void OnMouseClick(MouseEventArgs e) { _clicked = true; if (_selectedIndex != -1) { if (PenWidthSelected != null) { PenWidthSelected(this, EventArgs.Empty); } } if (_contextForm != null) { _contextForm.Hide(); } _contextForm = null; if (_wfes != null) { _wfes.CloseDropDown(); } }
/// <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)) { _currentSelected = recIndex; // More colors - open dialog if (_currentSelected == 40) { Color = OpenMoreColorsDialog(); } else if (_currentSelected == 41) { Color = OpenTransparencyDialog(); } else if (_currentSelected == 42) { Color = Color.Transparent; } else { Color = CustomColors.SelectableColors[recIndex]; colorToolTip.SetToolTip(this, CustomColors.SelectableColorsNames[recIndex]); } if (_contextForm != null) { _contextForm.Hide(); } _contextForm = null; if (_wfes != null) { _wfes.CloseDropDown(); } } } this.Refresh(); }