//
you're reading...
.NET 1.x, .NET 2.0

ToolboxItem

Over on the develomentor advanced-dotnet mailing list Frans Bouma recently posted an answer to the question: How do you perform an operation the first time a control is added to the form.

Considering the Design time stuff is something I need to learn more about I thought I’d post his answer here in case I need to do something like that in the future (not to mention help whoever may read this)

Though I’d use a Toolbox item
Create a simple class derived from System.Drawing.Design.ToolboxItem and add it to your control via the ToolboxItemAttribute, which takes a string or a typeof definition.

In your ToolboxItem class, you override CreateComponentsCore and you there create your control and also do your things you want to execute when the control is placed onto the form.

Advertisements

About James

I am a Senior Developer/Consultant for InfoPlanIT, LLC. I previously spent over 7 years as a Product Manager for what eventually became ComponentOne, a division of GrapeCity. While there, I helped to create ActiveReports 7, GrapeCity ActiveAnalysis, and Data Dynamics Reports.

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archive

%d bloggers like this: