private StringFormat string_format;
private Font bold_font;
private Brush inactive_text_brush;
+ private ListBox dropdown_list;
#endregion
#region Contructors
vbar.Value = 0;
vbar.Visible = false;
}
+ UpdateGridTextBoxBounds ((GridEntry)property_grid.SelectedGridItem);
}
- private bool GetScrollBarVisible ()
- {
- if (property_grid.RootGridItem == null)
- return false;
-
- int visibleRows = GetVisibleRowsCount ();
- int openedItems = GetVisibleItemsCount ((GridEntry)property_grid.RootGridItem);
- if (openedItems > visibleRows)
- return true;
- return false;
- }
+ // private bool GetScrollBarVisible ()
+ // {
+ // if (property_grid.RootGridItem == null)
+ // return false;
+ //
+ // int visibleRows = GetVisibleRowsCount ();
+ // int openedItems = GetVisibleItemsCount ((GridEntry)property_grid.RootGridItem);
+ // if (openedItems > visibleRows)
+ // return true;
+ // return false;
+ // }
#region Drawing Code
private void DrawGridItems (GridItemCollection grid_items, PaintEventArgs pevent, int depth, ref int yLoc) {
else {
ICollection std_values = entry.AcceptedValues;
if (std_values != null) {
- ListBox listBox = new ListBox ();
- listBox.BorderStyle = BorderStyle.FixedSingle;
+ if (dropdown_list == null)
+ dropdown_list = new ListBox ();
+ dropdown_list.Items.Clear ();
+ dropdown_list.BorderStyle = BorderStyle.FixedSingle;
int selected_index = 0;
int i = 0;
foreach (object obj in std_values) {
- listBox.Items.Add (obj);
+ dropdown_list.Items.Add (obj);
if (entry.ValueText != null && entry.ValueText.Equals (obj))
selected_index = i;
i++;
}
- listBox.Height = row_height * Math.Min (listBox.Items.Count, 15);
- listBox.Width = ClientRectangle.Width - SplitterLocation - (vbar.Visible ? vbar.Width : 0);
- listBox.KeyDown += new KeyEventHandler (listBox_KeyDown);
- listBox.MouseUp+=new MouseEventHandler (listBox_MouseUp);
+ dropdown_list.Height = row_height * Math.Min (dropdown_list.Items.Count, 15);
+ dropdown_list.Width = ClientRectangle.Width - SplitterLocation - (vbar.Visible ? vbar.Width : 0);
+ dropdown_list.KeyDown += new KeyEventHandler (listBox_KeyDown);
+ dropdown_list.MouseUp+=new MouseEventHandler (listBox_MouseUp);
if (std_values.Count > 0)
- listBox.SelectedIndex = selected_index;
- DropDownControl (listBox);
+ dropdown_list.SelectedIndex = selected_index;
+ DropDownControl (dropdown_list);
}
}
}
grid_textbox.ForeColor = SystemColors.ControlText;
grid_textbox.ReadOnly = !entry.IsEditable;
}
-
- int y = -vbar.Value*row_height;
- CalculateItemY (entry, property_grid.RootGridItem.GridItems, ref y);
- int x = SplitterLocation + ENTRY_SPACING + (entry.PaintValueSupported ? VALUE_PAINT_INDENT : 0);
- grid_textbox.SetBounds (x + ENTRY_SPACING, y + ENTRY_SPACING,
- ClientRectangle.Width - ENTRY_SPACING - x - (GetScrollBarVisible () ? vbar.Width : 0),
- row_height - ENTRY_SPACING);
+ UpdateGridTextBoxBounds (entry);
grid_textbox.Text = entry.IsMerged && !entry.HasMergedValue ? String.Empty : entry.ValueText;
grid_textbox.Visible = true;
InvalidateItem (entry);
}
}
+ private void UpdateGridTextBoxBounds (GridEntry entry)
+ {
+ if (entry == null)
+ return;
+ int y = -vbar.Value*row_height;
+ CalculateItemY (entry, property_grid.RootGridItem.GridItems, ref y);
+ int x = SplitterLocation + ENTRY_SPACING + (entry.PaintValueSupported ? VALUE_PAINT_INDENT : 0);
+ grid_textbox.SetBounds (x + ENTRY_SPACING, y + ENTRY_SPACING,
+ ClientRectangle.Width - ENTRY_SPACING - x - (vbar.Visible ? vbar.Width : 0),
+ row_height - ENTRY_SPACING);
+ }
+
// Calculates the sum of the heights of all items before the one
//
private bool CalculateItemY (GridEntry entry, GridItemCollection items, ref int y)