Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / January 2008

Tip: Looking for answers? Try searching our database.

Dragging components TO the toolbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe Burke - 06 Jan 2008 12:51 GMT
I noticed that you can configure a component on your design surface by
setting the properties to whatever you want, and then drag the component to
the toolbox.  The Toolbox will create a toolbox item called "Template1" and
you can share that pre-configured component across forms and projects.  But
this only seems to work for components in the component tray and not controls
or forms.

Can anyone help me understand why this only seems to work with components
and not controls?  Is there also a programmatic way to create the toolbox
item that has these pre-configured components?  And how are they saved in the
.tbd file?

Thanks for any help.
Joe
Walter Wang [MSFT] - 07 Jan 2008 07:38 GMT
Hi Joe,

This is a quick note to let you know that I am performing research on this
issue and will get back to you as soon as possible. I appreciate your
patience.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Joe Burke - 07 Jan 2008 13:57 GMT
Thanks Walter.  I forgot to mention that I'm using VS2005.  I'd also like to
know if VS2008 has the same behavior or is it different.

Joe

> Hi Joe,
>
[quoted text clipped - 12 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
Walter Wang [MSFT] - 08 Jan 2008 07:42 GMT
Hi Joe,

I've consulted your question with product group.

The behavior you observed is correct, which is also the same in VS2008.
It's just that the controls currently don't support being customized like
the components.

The components do not provide native support for user interaction via a
form, such as exposing a UI that's hosted by a form or handing keyboard and
mouse input. On the other hand intrinsic support for UI interaction is
provided by controls. This distinction is further reinformed by the
location where components are hosted on a form, specifically in an area as
the nonvisual design surface, or component tray.

This is not directly explaining why the controls don't support customizing
like the components but I think it's related to how they are implemented.
Actually control authors can usually provide a customized ToolboxItem such
as:

[ToolboxItem(typeof(MyToolboxItem))]
Class MyControl: Control { }

Class MyToolboxItem : ToolboxItem {
 Override CreateComponentsCore(¡­) {
   //set any additional property values here.
 }
}

Or you can programmatically add a toolbox item using
ToolboxService.AddToolboxItem. Most Visual Studio features do this during
ResetDefaults on their VSPackage -- which indicates that the items are
default items. You can also do this from an Addin, as long as you can get
IToolboxService.

Please let me know if you want more information about this.

Regarding the .tbd, it's merely a cache of the toolbox contents, for the
customized template of a component, it's simply a serialization of the
component in question.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Joe Burke - 08 Jan 2008 18:43 GMT
Thanks Walter, that's what I wanted to know.

Later,
Joe

> Hi Joe,
>
[quoted text clipped - 47 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.