\r
protected override void OnMouseMove (MouseEventArgs e) \r
{\r
- if (resizing_grid) {\r
+ if (resizing_grid) \r
+ {\r
splitter_location = Math.Max(e.X,V_INDENT);\r
Refresh();\r
}\r
\r
private GridItem GetSelectedGridItem (GridItemCollection grid_items, int y) \r
{\r
- foreach (GridItem child_grid_item in grid_items) {\r
- if (y > child_grid_item.Top && y < child_grid_item.Top + ROW_HEIGHT) {\r
+ foreach (GridItem child_grid_item in grid_items) \r
+ {\r
+ if (y > child_grid_item.Top && y < child_grid_item.Top + ROW_HEIGHT) \r
+ {\r
return child_grid_item;\r
}\r
GridItem foundItem = GetSelectedGridItem(child_grid_item.GridItems, y);\r
\r
protected override void OnMouseDown (MouseEventArgs e) \r
{\r
- if (e.X > splitter_location - RESIZE_WIDTH && e.X < splitter_location + RESIZE_WIDTH) {\r
+ if (e.X > splitter_location - RESIZE_WIDTH && e.X < splitter_location + RESIZE_WIDTH) \r
+ {\r
resizing_grid = true;\r
}\r
- else {\r
+ else \r
+ {\r
GridItem foundItem = GetSelectedGridItem(property_grid.grid_items, e.Y);\r
\r
if (foundItem != null)\r
{
try
{\r
- if (grid_item.PropertyDescriptor.Converter.GetStandardValuesSupported()) \r
- {\r
+ if (grid_item.PropertyDescriptor.Converter != null)\r
+ {\r
+ if (grid_item.PropertyDescriptor.Converter.GetStandardValuesSupported()) \r
+ {\r
\r
- grid_textbox.DropDownButtonVisible = true;\r
- grid_textbox.ReadOnly = true;
- }\r
+ grid_textbox.DropDownButtonVisible = true;\r
+ grid_textbox.ReadOnly = true;
+ }\r
+ }\r
+ else\r
+ {\r
+ System.Console.WriteLine("Converter not available for type {0}",grid_item.PropertyDescriptor.PropertyType);\r
+ }\r
+ \r
}
catch (Exception ex)
{
catch (Exception ex)\r
{\r
System.Console.WriteLine(ex.Message);\r
+ System.Console.WriteLine("Paint Value failed for type {0}",grid_item.PropertyDescriptor.PropertyType);\r
// design time stuff is not playing nice\r
}\r
xLoc += 27;\r
}\r
\r
Font font = this.Font;\r
- try {
- string value = grid_item.PropertyDescriptor.Converter.ConvertToString(grid_item.Value);\r
- if (grid_item.PropertyDescriptor.CanResetValue(property_grid.SelectedObject))\r
- font = new Font(font, FontStyle.Bold);\r
+ try \r
+ {
+ if (grid_item.PropertyDescriptor.Converter != null)
+ {
+ string value = grid_item.PropertyDescriptor.Converter.ConvertToString(grid_item.Value);\r
+ if (grid_item.PropertyDescriptor.CanResetValue(property_grid.SelectedObject))\r
+ font = new Font(font, FontStyle.Bold);\r
- pevent.Graphics.DrawString(value,font,SystemBrushes.WindowText,new RectangleF(xLoc,rect.Y+2, ClientRectangle.Width-(xLoc), ROW_HEIGHT));\r
+ pevent.Graphics.DrawString(value,font,SystemBrushes.WindowText,new RectangleF(xLoc,rect.Y+2, ClientRectangle.Width-(xLoc), ROW_HEIGHT));\r
+ }\r
+ else\r
+ {\r
+ System.Console.WriteLine("No converter for type {0}",grid_item.PropertyDescriptor.PropertyType);\r
+ }\r
\r
-}
+ }
catch (Exception e)
{
}
\r
private void TextBoxValidating (object sender, CancelEventArgs e) \r
{\r
- if (this.property_grid.SelectedGridItem != null) {\r
+ if (this.property_grid.SelectedGridItem != null) \r
+ {\r
PropertyDescriptor desc = property_grid.SelectedGridItem.PropertyDescriptor;\r
- if (desc != null) {\r
+ if (desc != null) \r
+ {\r
try \r
{\r
- \r
- SetPropertyValue(desc.Converter.ConvertFromString(grid_textbox.Text));\r
+ if (desc.Converter != null)\r
+ {\r
+ SetPropertyValue(desc.Converter.ConvertFromString(grid_textbox.Text));\r
+ }\r
+ else\r
+ {\r
+ System.Console.WriteLine("No converter for type {0}",desc.PropertyType);\r
+ }\r
}\r
catch (Exception ex)\r
{\r
\r
private void listBox_SelectedIndexChanged (object sender, EventArgs e) \r
{\r
- if (this.property_grid.SelectedGridItem != null) {\r
+ if (this.property_grid.SelectedGridItem != null) \r
+ {\r
PropertyDescriptor desc = property_grid.SelectedGridItem.PropertyDescriptor;\r
- if (desc != null) {\r
+ if (desc != null) \r
+ {\r
SetPropertyValue(((ListBox)sender).SelectedItem);\r
}\r
}\r
UITypeEditor editor = (UITypeEditor)property_grid.SelectedGridItem.PropertyDescriptor.GetEditor(typeof(UITypeEditor));\r
System.ComponentModel.Design.ServiceContainer service_container = new System.ComponentModel.Design.ServiceContainer();\r
service_container.AddService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService), this);\r
- SetPropertyValue(editor.EditValue(null, service_container,property_grid.SelectedGridItem.Value));\r
+ SetPropertyValue(editor.EditValue(new ITypeDescriptorContextImpl(this.property_grid), service_container,property_grid.SelectedGridItem.Value));\r
}\r
}\r
\r
XplatUI.ScrollWindow(Handle, 0, -ROW_HEIGHT, false);\r
Invalidate(ClientRectangle);\r
break;\r
- /*case ScrollEventType.ThumbTrack:\r
- XplatUI.ScrollWindow(Handle, 0, -(vbar.Value-e.NewValue), false);\r
- Invalidate(ClientRectangle);\r
- break;\r
- case ScrollEventType.ThumbPosition:\r
- Invalidate(ClientRectangle);\r
- break;*/\r
+ /*case ScrollEventType.ThumbTrack:\r
+ XplatUI.ScrollWindow(Handle, 0, -(vbar.Value-e.NewValue), false);\r
+ Invalidate(ClientRectangle);\r
+ break;\r
+ case ScrollEventType.ThumbPosition:\r
+ Invalidate(ClientRectangle);\r
+ break;*/\r
}\r
}\r
\r
//Region clip = new Region();\r
//if (property_grid.SelectedGridItem != null)\r
// clip.Union(new Rectangle(0,property_grid.SelectedGridItem.Top, ClientRectangle.Width, ROW_HEIGHT));\r
- // clip.Union(new Rectangle(0,property_grid.SelectedGridItem.Top, ClientRectangle.Width, ROW_HEIGHT));\r
+ // clip.Union(new Rectangle(0,property_grid.SelectedGridItem.Top, ClientRectangle.Width, ROW_HEIGHT));\r
\r
if (e.NewSelection.PropertyDescriptor != null)\r
{\r
{\r
get\r
{\r
- // TODO: Add SystemComp.Instance getter implementation\r
- return null;\r
+ return property_grid.SelectedGridItem.Value;\r
}\r
}\r
\r
{\r
get\r
{\r
- // TODO: Add SystemComp.PropertyDescriptor getter implementation\r
- return null;\r
+ return property_grid.SelectedGridItem.PropertyDescriptor;\r
}\r
}\r
\r
get \r
{
CreateParams cp = base.CreateParams;
- cp.Style = unchecked ((int)(WindowStyles.WS_POPUP | WindowStyles.WS_VISIBLE | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CLIPCHILDREN));
- cp.ExStyle |= (int)(WindowStyles.WS_EX_TOOLWINDOW | WindowStyles.WS_EX_TOPMOST);
+ cp.Style = unchecked ((int)(WindowStyles.WS_POPUP | WindowStyles.WS_VISIBLE | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CLIPCHILDREN));
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_TOOLWINDOW | WindowStyles.WS_EX_TOPMOST);
return cp;
}
}