C#
  Home arrow C# arrow Page 5 - Custom Controls and Design-Time Support: P...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

Custom Controls and Design-Time Support: Part 2/2
By: Wrox Team
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 17
    2003-01-13

    Table of Contents:
  • Custom Controls and Design-Time Support: Part 2/2
  • The DirectoryTree
  • Filtering Control Class Members
  • Designer Verbs
  • UITypeEditors
  • Custom UITypeEditors
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Custom Controls and Design-Time Support: Part 2/2 - UITypeEditors


    (Page 5 of 7 )

    The Properties window does a solid job of providing support for all common data types. Basic data types like strings and numbers are all seamlessly supported. If you create a property that uses a custom enumeration, the Properties window automatically provides a drop-down list with the values from the enumeration.

    In addition to this basic level of support, you may have noticed that some richer object types have additional design-time support.

    For example, if you create a Property that has a Font or Color data type, a special color picker or font selection dialog will be used in the Properties window. Similar magic happens if you create a Collection property.

    This support is provided through .NET UITypeEditor classes, which are special components that provide the design-time user interface that allows the programmer to set complex properties.

    Prebuilt UITypeEditors

    The base UITypeEditor class is found in the System.Drawing.Design namespace. You can inherit from this class to create your own custom UITypeEditors, or you can use one of the derived classes that are provided with the .NET framework.

    These classes are listed below (UITypeEditors that are only usable with specific web controls have been omitted-see MSDN for more information about those).

    ClassDescription
    System.ComponentModel.Design.ArrayEditorEdits an array by allowing the programmer to enter a list of strings. Used automatically for supported arrays.

    System.Drawing.Design.FontEditor
    Allows the programmer to select and configure a font. Used automatically for font properties.
    System.Drawing.Design.ImageEditorAllows the programmer to create an Image object by selecting a bitmap from an open file dialog. Used automatically for image types.
    System.Web.UI.Design.WebControls.RegexTypeEditorAllows the programmer to choose a regular expression from a list of common choices. This UITypeEditor works with string properties.
    System.Windows.Forms.Design.AnchorEditorAllows the Anchor property to be set at design time.
    System.Windows.Forms.Design.FileNameEditorAllows a fully qualified filename to be set by choosing a file from an open file dialog box. This UITypeEditor works with string properties.


    Depending on the data type of your property, .NET may use the corresponding UITypeEditor automatically (for example, with a Font).

    On the other hand, some UITypeEditors do not have dedicated types. An example is the RegExTypeEditor, which allows the programmer to choose a common regular expression for a control property. The regular expression is stored as an ordinary string, so it needs to be explicitly associated with the appropriate UITypeEditor.

    More C# Articles
    More By Wrox Team


     

    C# ARTICLES

    - Introduction to Objects and Classes in C#, P...
    - Visual C#.NET, Part 1: Introduction to Progr...
    - C# - An Introduction
    - Hotmail Exposed: Access Hotmail using C#
    - Razor Sharp C#
    - Introduction to Objects and Classes in C#
    - Making Your Code CLS Compliant
    - Programming with MySQL and .NET Technologies
    - Socket Programming in C# - Part II
    - Socket Programming in C# - Part I
    - Creational Patterns in C#
    - Type Conversions
    - Creating Custom Delegates and Events in C#
    - Inheritance and Polymorphism
    - Understanding Properties in C#






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT