Designer Services

function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); }

Designer Services can be divided into three major sections: component designers, Windows Forms Designers, and drawing designers. The component designers provide the core functionality of the .NET framework designer architecture, whereas the Windows Forms Designers extend the design-time support for Windows Forms. The list of classes, interfaces, delegates, and enumerations for these three designer sections is rather extensive. They are discussed in the following sections.

System.ComponentModel.Design Namespace

The System.ComponentModel.Design namespace contains the core .NET framework designer architecture classes and interfaces that can be used to define designers and custom editors for components at design-time. Tables 5.1 through 5.4 list the classes, interfaces, delegates, and enumerations, respectively, along with a brief description of each.

Table 5.1. Classes
Class Description
ActiveDesignerEventArgs EventArgs data for the ActiveDesigner event.
ArrayEditor UITypeEditor allows for editing arrays at design-time.
ByteViewer Displays the content of byte arrays in hexadecimal, ANSI, and Unicode formats.
CollectionEditor UITypeEditor provides for basic collection editing.
CollectionEditor.CollectionForm Modal dialog for editing the collection using a UITypeEditor.
CommandID A unique command identifier consisting of a numeric command ID and a GUID menu group identifier.
ComponentChangedEventArgs EventArgs data for the ComponentChanged event.
ComponentChangingEventArgs EventArgs data for the ComponentChanging event.
ComponentDesigner Base designer class that provides support for component designer services.
ComponentDesigner.ShadowPropertyCollection A collection of shadowed properties that should override inherited default or assigned values. Example: The Visible property is shadowed during design-time.
ComponentEventArgs EventArgs data for the ComponentAdded, ComponentAdding, ComponentChanged, ComponentChanging, ComponentRemoved, ComponentRemoving, and ComponentRename events.
ComponentRenameEventArgs EventArgs data for the ComponentRename Event.
DesignerCollection Collection of designer documents.
DesignerEventArgs EventArgs data for the DesignerCreated and DesignerDisposed events.
DesignerTransaction Provides a mechanism for undoing a series of changes during design-time.
DesignerTransactionCloseEventArgs EventArgs data for the TransactionClosed and TransactionClosing events.
DesignerVerb A custom verb that can be invoked by the designer.
DesignerVerbCollection Collection of DesignerVerb objects.
DesigntimeLicenseContext Context for supporting design-time license providers.
DesigntimeLicenseContextSerializer Provides serialization services for license contexts.
InheritanceService Allows for identifying inherited components.
LocalizationExtenderProvider Design-time localization support for code generators.
MenuCommand Menu or toolbar command item.
ServiceContainer Implements the IServiceContainer interface.
StandardCommands Defines the standard set of commands common to most applications.
StandardToolWindows GUID identifiers to the set of tool windows available in the design environment.

Table 5.2. Interfaces
Interface Description
IComponentChangeService Interface to add and remove component event handlers and provides methods for raising ComponentChanged and ComponentChanging events.
IDesigner The base designer interface for building custom component designers.
IDesignerEventService Event notifications for the addition and removal of designers, selection changes, and provides the capability to add designers.
IDesignerFilter Allows for Pre and Post filtering of events, properties, and attributes for a component.
IDesignerHost Interface for mapping designer transactions and components.
IDesignerOptionService Interface to access the designer options found on the Options submenu under the Tools menu.
IDictionaryService Dictionary interface for a designer to store user-defined data.
IEventBindingService Exposes events as PropertyDescriptor objects.
IExtenderListService Provides enumeration of extender providers. A ToolTip component implements the IExtenderProvider interface.
IExtenderProviderService Interface to add and remove extender providers at design-time.
IHelpService Used to provide the IDE with context help information about the current task.
IInheritanceService Used for identifying inherited components.
IMenuCommandService Interface to add and remove commands and verbs to and from the VS .NET menu.
IReferenceService Interface to names of and references to objects within a designer project.
IResourceService Provides access to specific CultureInfo resources.
IRootDesigner Support for view technologies.
ISelectionService Used to select components at design-time.
IServiceContainer Provides access to the various design-time services.
ITypeDescriptorFilterService Used to filter TypeDescriptor items of a component. TypeDescriptor items include properties, attributes, and events.
ITypeResolutionService Retrieves an assembly or type by name.

Table 5.3. Delegates
Delegate Description
ActiveDesignerEventHandler Handles the ActiveDesignerChanged event.
ComponentChangedEventHandler Handles the ComponentChanged event.
ComponentChangingEventHandler Handles the ComponentChanging event.
ComponentEventHandler Handles the ComponentAdding, ComponentAdded, ComponentRemoved, and ComponentRemoving events.
ComponentRenameEventHandler Handles the ComponentRename event.
DesignerEventHandler Handles the DesignerCreated and DesignerDisposed events.
DesignerTransactionCloseEventHandler Handles the TransactionClosed and TransactionClosing events.
ServiceCreatorCallback A callback handler that can create an instance of a service on demand.

Table 5.4. Enumerations
Enumeration Description
DisplayMode Used by the ByteViewer to indicate the display type (Auto, Hex, ANSI, or Unicode).
HelpContextType Identifiers used by the Help system.
HelpKeywordType Identifies the type of a Help keyword.
SelectionTypes Determines the type of selection mechanism a component supports.
ViewTechnology Currently Passthrough and WindowsForms. Defines the view support that a designer host supports.

The granular design of the designer framework allows for fine-tuning of a component designer and supported services. The Windows Forms Designer builds on the ComponentModel design framework to extend the design-time support.

System.Windows.Forms.Design Namespace

Tables 5.5 through 5.7 list the classes, interfaces, and enumerations provided by the Windows Forms Designer framework.

Table 5.5. Classes
Class Description
AnchorEditor UITypeEditor for the Anchor layout property.
AxImporter Imports ActiveX controls and generates a runtime callable wrapper.
AxImporter.Options Options for the AxImporter.
AxParameterData Design-time data for the ActiveX control.
AxWrapperGen Generates the wrapper for ActiveX controls.
ComponentDocumentDesigner Windows Forms Designer for designing components.
ComponentEditorForm UI for a WindowsFormsComponentEditor.
ComponentEditorPage An empty window that can be extended to add controls.
ComponentTray UI for the component tray in the Forms Designer.
ControlDesigner Base class for a designer for components that extend the Control base class.
DocumentDesigner Extends the ScrollableControlDesigner and implements IRootDesigner. The Forms Designer is a DocumentDesigner.
EventsTab A PropertyTab for event selection and linking. Used by the PropertyGrid.
FileNameEditor UITypeEditor for filenames.
FolderNameEditor UITypeEditor for folders.
MenuCommands IDs and GUIDS that correspond to the host Command Bar menu layout.
ParentControlDesigner Provides design-time support for selection UI handling of child controls and the capability to manipulate child controls.
PropertyTab Base class for property tabs. Used by the PropertyGrid.
ScrollableControlDesigner Inherits from ParentControlDesigner and provides support for scrollable controls.
WindowsFormsComponentEditor Provides a base class for editors that use property pages similar to ActiveX control's property pages.

Table 5.6. Interfaces
Interface Description
IMenuEditorService Provides access to the menu editing service. This service is implemented by the host designer.
IUIService Provides interaction with the UI of the development environment that is hosting the designer.
IWindowsFormsEditorService Used by the PropertyGrid and designers to display custom UITypeEditors.

Table 5.7. Enumerations
Enumeration Description
SelectionRules Selection rule for a component as it relates to moving and sizing.

System.Drawing.Design Namespace

The last major area of designers includes the services provided under the System.Drawing.Desing namespace. As you might expect from the name, the designers and services provided deal with UI presentation and drawing logic. In addition, interaction with the Windows Forms ToolBox is provided within this namespace. Tables 5.8 through 5.11 show the classes, interfaces, delegates, and enumerations, respectively, that are provided by the System.Drawing.Design namespace.

Table 5.8. Classes
Class Description
BitmapEditor UITypeEditor for selecting bitmaps from the Property Grid.
CategoryNameCollection Collection of CategoryAttributes used by the PropertyGrid.
FontEditor Editor for a Font object.
ImageEditor UITypeEditor for selecting images.
PaintValueEventArgs EventArgs data for the PaintEvent.
PropertyValueUIItem Invoke handler, tool tip, and the icon for a property displayed on the properties window.
ToolboxComponentsCreatedEventArgs EventArgs data for the ComponentsCreated event when items are added to the toolbox.
ToolboxComponentsCreatingEventArgs EventArgs data for the ComponentsCreating event of the toolbox.
ToolboxItem Item contained within the toolbox.
ToolboxItemCollection Collection of toolbox items.
UITypeEditor Provides a UI for representing and editing of the values of objects (discussed in the properties section).

Table 5.9. Interfaces
Interface Description
IPropertyValueUIService Allows management of the properties list of the properties window.
IToolboxService Allows interaction with the toolbox.
IToolboxUser Allows testing of the toolbox for toolbox item support and selection of a toolbox item.

Table 5.10. Delegates
Delegate Description
PropertyValueUIHandler Handles the events from the IPropertyValueUIService.
PropertyValueUIItemInvokeHandler Handles the InvokeHandler event of the PropertyValueUIItem.
ToolboxComponentsCreatedEventHandler Handles the ComponentsCreated event.
ToolboxComponentsCreatingEventHandler Handles the ComponentsCreating event.
ToolboxItemCreatorCallback Handles the ToolboxComponentsCreatingEventHandler event.

Table 5.11. Enumerations
Enumeration Description
UITypeEditorEditStyle Indicates the value editing style for a UITypeEditor (DropDown, Modal, None).

At this point, you are likely feeling overwhelmed by the number of services available through the System.ComponentModel.Design namespace and the System.Windows.Forms.Design namespace. Fortunately, the use of all these services is rarely needed not even for complex custom controls. It's also important to remember that each service provided is extremely granular in scope and as such its use is easier to understand. One last note: a lot of the services are already provided free; that is, you don't have to do anything to make use of them.

Note that the IconButton we developed has not made any explicit reference to most of the available designer services, yet the control and its associated designer are fully functional. There are times, however, when it is necessary to use the services available. During the development of the OutlookBar control, many of the services will be used.



    .NET Windows Forms Custom Controls
    User Interfaces in VB .NET: Windows Forms and Custom Controls
    ISBN: 1590590449
    EAN: 2147483647
    Year: 2002
    Pages: 74

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net