private object current_property_value;
#endregion // Private Members
-
+
#region Contructors
public PropertyGrid() {
selected_objects = new object[1];
property_sort = PropertySort.Categorized;
property_grid_view = new PropertyGridView(this);
- property_grid_view.Dock = DockStyle.Fill;
splitter = new Splitter();
splitter.Dock = DockStyle.Bottom;
help_panel.Controls.Add(help_title_label);
help_panel.Paint+=new PaintEventHandler(help_panel_Paint);
- toolbar = new ToolBar();
+ toolbar = new PropertyToolBar();
toolbar.Dock = DockStyle.Top;
categorized_toolbarbutton = new ToolBarButton();
alphabetic_toolbarbutton = new ToolBarButton();
description_menuitem.Checked = this.HelpVisible;
this.ContextMenu = context_menu;
toolbar.ContextMenu = context_menu;
-
- this.Controls.Add(property_grid_view);
+
+ BorderHelperControl helper = new BorderHelperControl ();
+ helper.Dock = DockStyle.Fill;
+ helper.Controls.Add (property_grid_view);
+
+ this.Controls.Add(helper);
this.Controls.Add(toolbar);
this.Controls.Add(splitter);
this.Controls.Add(help_panel);
}
set {
- if (base.BackColor == value) {
- return;
- }
base.BackColor = value;
+ toolbar.BackColor = value;
+ Refresh ();
}
}
}
property_sort = value;
-
+
+ UpdateToolBarButtons();
ReflectObjects();
property_grid_view.Refresh();
}
protected override void OnPaint (PaintEventArgs pevent) {
+ pevent.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(BackColor), pevent.ClipRectangle);
base.OnPaint (pevent);
}
else if (e.Button == categorized_toolbarbutton) {
this.PropertySort = PropertySort.Categorized;
}
- UpdateToolBarButtons();
- ReflectObjects();
- property_grid_view.Refresh();
}
internal void UpdateToolBarButtons () {
}
private void PopulateGridItemCollection (object obj, GridItemCollection grid_item_coll, bool recurse) {
+ if (!recurse && !TypeDescriptor.GetConverter(obj).GetPropertiesSupported())
+ return;
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(obj);
foreach (PropertyDescriptor property in properties) {
if (property.IsBrowsable) {
}
}
#endif
+
+ // as we can not change the color for BorderStyle.FixedSingle and we need the correct
+ // ClientRectangle so that the ScrollBar doesn't draw over the border we need this class
+ internal class BorderHelperControl : Control {
+
+ public BorderHelperControl ()
+ {
+ BackColor = ThemeEngine.Current.ColorWindow;
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ e.Graphics.DrawRectangle (SystemPens.ControlDark, 0 , 0 , Width - 1, Height - 1);
+ base.OnPaint (e);
+ }
+
+ protected override void OnSizeChanged (EventArgs e)
+ {
+ if (Controls.Count == 1) {
+ Control control = Controls [0];
+
+ if (control.Location.X != 1 || control.Location.Y != 1)
+ control.Location = new Point (1, 1);
+
+ control.Width = ClientRectangle.Width - 2;
+ control.Height = ClientRectangle.Height - 2;
+
+ Refresh ();
+ }
+ base.OnSizeChanged (e);
+ }
+ }
+
+ // needed! this little helper makes it possible to draw a different toolbar border
+ // and toolbar backcolor in ThemeWin32Classic
+ internal class PropertyToolBar : ToolBar {}
}
}