private void OnMouseClick(MouseUpEvent mouseEvent) { if (mouseEvent.button == 0) // Left click to select the tile { for (int i = 0; i < tileAreas.Count; i++) { if (tileAreas[i].Contains(mouseEvent.mousePosition)) { selectedTileNum = i; selectedTile = gridTilesList[i]; } } } else if (mouseEvent.button == 1) // Right click to create dropdown menu of tile options for that tile { for (int i = 0; i < tileAreas.Count; i++) { if (tileAreas[i].Contains(mouseEvent.mousePosition)) { selectedTileNum = i; selectedTile = gridTilesList[i]; } } CustomDropDown.Show(this, mouseEvent.mousePosition, selectedTile); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ internal DropDownFiltersListBox() { m_dropDown = new CustomDropDown(); m_dropDown.AutoCloseWhenMouseLeaves = false; m_dropDown.Closed += m_dropDown_Closed; m_dropDown.AddControl(this); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handles the event when the user has clicked on the drop-down button in a value /// cell. The object dropped-down depends on the expression type. If the expression /// type is normal, then the drop-down contains a list of field values found in the /// cache for the field specified in the field column. If the expression type is a /// phonetic search, then the drop-down is a search query options drop-down for the /// query that better be stored in the tag property of the current row's expression /// type cell. If the expression type is a regular expression, then their is no /// drop-down. /// </summary> /// ------------------------------------------------------------------------------------ private void HandleValueColumnButtonClicked(object sender, DataGridViewCellMouseEventArgs e) { string expType = m_grid[kTypeCol, e.RowIndex].Value as string; if (string.IsNullOrEmpty(expType)) { return; } if ((m_grid[kFieldCol, e.RowIndex].Value as string) == FilterExpression.OtherFilterField) { if (FilterHelper.FilterList.Count != 0) { m_filterDropDown.Show(m_grid[kValueCol, e.RowIndex]); } } else if (expType == m_expTypeToText[ExpressionType.PhoneticSrchPtrn]) { SearchQuery query = m_grid[kTypeCol, e.RowIndex].Tag as SearchQuery; SearchOptionsDropDown sodd = new SearchOptionsDropDown(query); m_queryDropDown = new CustomDropDown(); m_queryDropDown.Closed += m_queryDropDown_Closed; m_queryDropDown.AddControl(sodd); Rectangle rc = m_grid.GetCellDisplayRectangle(2, e.RowIndex, false); rc.Y += rc.Height; m_queryDropDown.Show(m_grid.PointToScreen(rc.Location)); } else { m_filterDropDown.Show(m_grid[kValueCol, e.RowIndex], m_grid[kFieldCol, e.RowIndex].Value as string); } }
/// ------------------------------------------------------------------------------------ public FontPicker() { if (m_dropDown == null) { m_dropDown = new CustomDropDown(); m_dropDown.AutoCloseWhenMouseLeaves = false; m_dropDown.AddControl(this); m_dropDown.Closing += HandleDropDownClosing; m_dropDown.Closed += delegate { OnClose(DialogResult); }; } InitializeComponent(); cboFontFamily.Font = FontHelper.UIFont; cboSize.Font = FontHelper.UIFont; chkBold.Font = FontHelper.UIFont; chkItalic.Font = FontHelper.UIFont; DoubleBuffered = true; pnlSample.TextFormatFlags |= TextFormatFlags.HorizontalCenter; cboFontFamily.Items.AddRange(new InstalledFontCollection().Families.Select(f => f.Name).ToArray()); cboSize.Items.AddRange(new object[] { 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, 36, 48, 72 }); DialogResult = DialogResult.Cancel; }
/// ------------------------------------------------------------------------------------ public static CustomDropDown Create(Func <int> getWidthHandler, Action <string> itemSelectedHandler) { var phoneDropDown = new PatternBuilderPhoneDropDown(); phoneDropDown.m_getWidthHandler = getWidthHandler; phoneDropDown.m_itemSelectedHandler = itemSelectedHandler; var hostingDropDown = new CustomDropDown(); hostingDropDown.AddControl(phoneDropDown); hostingDropDown.Opening += phoneDropDown.LoadControls; hostingDropDown.Opened += delegate { phoneDropDown.Focus(); }; return(hostingDropDown); }
/// ------------------------------------------------------------------------------------ public CellCustomDropDownList() { DoubleBuffered = true; _dropDown = new CustomDropDown(); _dropDown.AutoCloseWhenMouseLeaves = false; _dropDown.AddControl(this); _dropDown.Closed += delegate { _associatedCell = null; }; _listBox = new ListBox(); _listBox.BorderStyle = BorderStyle.None; _listBox.Dock = DockStyle.Fill; _listBox.KeyDown += HandleListBoxKeyDown; _listBox.MouseClick += HandleListBoxMouseClick; _listBox.MouseMove += HandleListBoxMouseMove; BorderStyle = BorderStyle.FixedSingle; Padding = new Padding(1); Controls.Add(_listBox); Font = SystemFonts.IconTitleFont; }
/// ------------------------------------------------------------------------------------ public CellCustomDropDownList() { DoubleBuffered = true; m_dropDown = new CustomDropDown(); m_dropDown.AutoCloseWhenMouseLeaves = false; m_dropDown.AddControl(this); m_dropDown.Closed += delegate { m_cell = null; }; m_listBox = new ListBox(); m_listBox.BorderStyle = BorderStyle.None; m_listBox.Dock = DockStyle.Fill; m_listBox.KeyDown += HandleListBoxKeyDown; m_listBox.MouseClick += HandleListBoxMouseClick; m_listBox.MouseMove += HandleListBoxMouseMove; BorderStyle = BorderStyle.FixedSingle; Padding = new Padding(1); Controls.Add(m_listBox); Font = FontHelper.UIFont; }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public PaAddOnManager() { try { Assembly assembly = Assembly.GetExecutingAssembly(); string settingName = Path.GetFileNameWithoutExtension(assembly.CodeBase); if (!PaApp.SettingsHandler.GetBoolSettingsValue(settingName, "Enabled", true)) { return; } PaApp.AddMediatorColleague(this); m_dropDown = new CustomDropDown(); m_numPhonesCtrl = new NumberOfPhonesToMatchCtrl(); m_numPhonesCtrl.lnkApply.Click += lnkApply_Click; m_dropDown.AddControl(m_numPhonesCtrl); m_fntGlyph = new Font("Marlett", 9); } catch { } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public PhoneInventoryDlg() { InitializeComponent(); BuildGrid(); LoadGrid(); m_sddpFeatures = new SizableDropDownPanel(Name + "FeatureDropDown", new Size(m_grid.Columns["features"].Width, 100)); m_sddpFeatures.BorderStyle = BorderStyle.FixedSingle; m_sddpFeatures.Padding = new Padding(7, 7, 7, m_sddpFeatures.Padding.Bottom); m_lvFeatures = new FeatureListView(PaApp.FeatureType.Articulatory); m_lvFeatures.Dock = DockStyle.Fill; m_lvFeatures.Load(); m_lvFeatures.FeatureChanged += new FeatureListView.FeatureChangedHandler(m_lvFeatures_FeatureChanged); m_sddpFeatures.Controls.Add(m_lvFeatures); m_dropdown = new CustomDropDown(); m_dropdown.AutoCloseWhenMouseLeaves = false; m_dropdown.AddControl(m_sddpFeatures); m_dropdown.Closing += m_dropdown_Closing; }
public virtual Control CreateLegend(DataSetDictionary datasets, string title) { Dropdown = new CustomDropDown { Flat = false, Text = title, FocusMode = FocusModeEnum.None, }; Dropdown.Popup.HideOnCheckableItemSelection = false; Dropdown.Popup.HideOnItemSelection = false; foreach (var data in datasets) { AddSpeciesToList(data); } Dropdown.CreateElements(); Dropdown.Popup.Connect("index_pressed", this, nameof(OnDropDownLegendItemSelected)); return(Dropdown); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void m_queryDropDown_Closed(object sender, ToolStripDropDownClosedEventArgs e) { m_queryDropDown.Closed -= m_queryDropDown_Closed; m_queryDropDown = null; }