Five bullet points you might not see on the back of the box


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.  =)



  • Multiline text editor for string properties.


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;
            }
        }
    }



  • DisplayName attribute makes extender providers look like properties.


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;
        }       
    }



  • BrowsableAttribute now applies to Enums


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; }
        }
      
    }



  • Item editing experience for TreeViews and Menus


You can now design the nodes in the treeview and add custom menu items in the designer*.  (* requires new ToolStrip/MenuStrip stuff)



  • ImageList editing experience


….and my personal favorite: The image list now lets you add more than one image at a time!  😉

Comments (4)

  1. Steve says:

    >> The image list now lets you add more than one image at a time!

    That has annoyed me for a loooong time… who ever pushed for that feature deserves a raise and a kiss!

  2. anon says:

    One thing I’ve been wondering about imagelists is why you can’t choose images from your resources (the ones you can choose from when you set toolstrip icons, for example).

  3. jfoscoding says:

    Interesting suggestion. We had not really thought about this.

    I can see one huge pitfall to it though. The problem with being able to pick out images from your resource is that it would double the size of the resources in your project. There would be one representation of the image by itself, plus the representation in the image stream. This would increase the size of your DLL as the resource would be compiled in two distinct representations.

Skip to main content