private void DialogButtonClicked(object sender, EventArgs e) { GridEntry entry = this.SelectedGridItem as GridEntry; if (entry != null && entry.HasCustomEditor) { entry.EditValue((IWindowsFormsEditorService)this); } }
private void DropDownEdit() { GridEntry entry = this.SelectedGridItem as GridEntry; if (entry == null) { return; } if (entry.HasCustomEditor) { entry.EditValue((IWindowsFormsEditorService)this); } else { if (dropdown_form.Visible) { CloseDropDown(); } else { ICollection std_values = entry.AcceptedValues; if (std_values != null) { if (dropdown_list == null) { dropdown_list = new ListBox(); dropdown_list.KeyDown += new KeyEventHandler(listBox_KeyDown); dropdown_list.MouseUp += new MouseEventHandler(listBox_MouseUp); } dropdown_list.Items.Clear(); dropdown_list.BorderStyle = BorderStyle.FixedSingle; int selected_index = 0; int i = 0; string valueText = entry.ValueText; foreach (object obj in std_values) { dropdown_list.Items.Add(obj); if (valueText != null && valueText.Equals(obj)) { selected_index = i; } i++; } dropdown_list.Height = row_height * Math.Min(dropdown_list.Items.Count, 15); dropdown_list.Width = ClientRectangle.Width - SplitterLocation - (vbar.Visible ? vbar.Width : 0); if (std_values.Count > 0) { dropdown_list.SelectedIndex = selected_index; } DropDownControl(dropdown_list); } } } }