For TitledThumbnail, we
want a menu item that when selected displays its custom component editor as described
previously. To implement the desired menu item, we build an event handler to create the
component editor UI:
private void OnPropertyBuilder(object sender, EventArgs e)
{
TitledThumbnailComponentEditor TitledThumbnailPropsEditor = new
TitledThumbnailComponentEditor();
TitledThumbnailPropsEditor.EditComponent(Component);
}
The event handler creates a TitledThumbnailComponentEditor and calls its EditComponent
method.
Listing 11-13 provides the source code for TitledThumbnailDesigner. In the listing, you
find the override of the Verbs collection where a new DesgnerVerbCollection is created and the
Property Builder menu item is added to the collection and associated with the OnPropertyBuilder
event handler.
Listing 11-13. The TitledThumbnailDesigner Class File
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Web.UI;
using System.Web.UI.Design;
namespace ControlsBook2Lib.Ch11.Design
{
public class TitledThumbnailDesigner : ControlDesigner
{
private DesignerVerbCollection designTimeVerbs;
public override DesignerVerbCollection Verbs
{
get
{
if ( null == designTimeVerbs)
{
designTimeVerbs = new DesignerVerbCollection();
designTimeVerbs.
Pages:
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737