Custom Controls Design Time Support Part 0: Introduction

In my amr-elsehemy.blogspot.com I started a design time support tutorial for custom controls but I didn't manage to finish them so I will start my blog here on amrelsehemy.net by editing my previous posts and adding new tutorials.

So if you came from my blogspot you may still find some new useful information, so lets start.

You need to be familiar with some terms when working with the design time environment .

Design Time Archticeture

[more]

Type: The Custom Control or Component that will take advantage of the design time environment.

Member(s): The members of the Type usually Properties and Events, sometimes methods.

Attributes: They are responsible to associate the Type and/or the Member(s) of the type with a class that extends design time behaviour.

Designers: They are used to customize the behavior of a component at design time, including its appearance, initialization, and interaction with the user. A designer can add, remove, or replace properties listed in a property browser for a selected component. They can provide user-defined methods that can be linked to certain component events or executed from a custom menu command, or DesignerVerb. A designer can also use services provided by a design-time environment.

Type Converters: They can be implemented to convert values between the type it is built to support and other data types that it can translate values to or from. A type converter can also provide logic to enable configuration of a property within a property browser at design time. A type converter can provide a list of standard values for a property of the type it supports at design time in a property browser. A type converter can also produce initialization code to initialize a property at design time.

UI Type Editors: They can provide a custom user interface (UI) for editing the value of a property and displaying a representation of the value of the property at design time. A UI type editor is type-specific and provides a user interface for configuring properties of the type it is built to support, or derived types which do not have an overriding attribute, at design time. A UI type editor can display a Windows Form or drop-down configuration interface for configuring a property.

Design Time Environment: The Visual Studio would be the perfect host.

Design Time Services: Services provided by the Visual Studio as ( IComponentChangeService, ISelectionService, IMenuCommandService and much more )

Forms Designer: The actual area that you interacts with, where you place controls on.

Properties Window: The special property grid window in the visual studio.

I will try to discuss each one with some few code examples to make everything clear.

References:

http://msdn2.microsoft.com/en-us/library/c5z9s1h4.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *