Coming in to work today, I was thinking of small improvements that make everyone's life just a little bit better working with the designer experience in VS. I thought I'd come up with the list of five bullet points that may not quite make it to the back of the box...
I guess we'll all find out why I'm not in marketing. =)
Instead of cramming multiple lines of text into a single line text box, you can now specify a multiline string editor for your string property. public class MyButton : Button { private string myString; [Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))] public string MyText { get { return myString; } set { myString = value; } } }
Instead of cramming multiple lines of text into a single line text box, you can now specify a multiline string editor for your string property.
public class MyButton : Button {
private string myString;
[Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))] public string MyText { get { return myString; } set { myString = value; } } }
Instead of getting "MyCustomProperty on SomeRandomObject", you can control how the property looks by specifying the DisplayName attribute. The FlowLayoutPanel and TableLayoutPanel use this technique to add property looking things to the controls within them. [ProvideProperty("MyCustomProperty", typeof(Control))] public class MyButton : Button, IExtenderProvider { [DisplayName("MyCustomProperty")] public string GetMyCustomProperty(object obj) { return "isnt this so cool?"; } public void SetMyCustomProperty(object obj, string value) { } public bool CanExtend(object extendee) { return extendee is Control; } }
Instead of getting "MyCustomProperty on SomeRandomObject", you can control how the property looks by specifying the DisplayName attribute. The FlowLayoutPanel and TableLayoutPanel use this technique to add property looking things to the controls within them. [ProvideProperty("MyCustomProperty", typeof(Control))] public class MyButton : Button, IExtenderProvider {
[DisplayName("MyCustomProperty")] public string GetMyCustomProperty(object obj) { return "isnt this so cool?"; } public void SetMyCustomProperty(object obj, string value) {
}
public bool CanExtend(object extendee) { return extendee is Control; } }
Say you want one enum value to not show up in the property grid. No problem! Set it to Browsable=false! public enum SomeEnum { [Browsable(false)] SomeValueIWantToHide, One, Two, Three } public class MyButton : Button { private SomeEnum someEnum = SomeEnum.One; public SomeEnum SomeProperty { get { return someEnum; } set { someEnum = value; } } }
Say you want one enum value to not show up in the property grid. No problem! Set it to Browsable=false!
public enum SomeEnum { [Browsable(false)] SomeValueIWantToHide, One, Two, Three }
private SomeEnum someEnum = SomeEnum.One;
public SomeEnum SomeProperty { get { return someEnum; } set { someEnum = value; } } }
You can now design the nodes in the treeview and add custom menu items in the designer*. (* requires new ToolStrip/MenuStrip stuff)
....and my personal favorite: The image list now lets you add more than one image at a time! ;-)