How to write a control displayable on the toolbar of VS.Net IDE ?

K

kusanagihk

To all,

Does anybody got any idea of how to write a UI control that can be
displayable on the ToolBar (ie. you can drag drop it on the Form just
like a Button Control provided in VS.Net)? Since I need to override
some functions of the Button object for the whole project afterwards;
so it is more convenient to extend the Button class but after extending
it, it can't be drag-drop on the Form.....

It should be possible, since there are 3rd party controls such as
OpenNet's framework classes that can do such things.

Any ideas? And what kind of project is it? (really a User Control
project or just a Dll project or any other thing ?)

Thanks!
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,

Apply the properly configured ToolboxAttribute to the control.
Add the control to the IDE's toolbox with the toolbox' customization means
(Add/Remove Items from the right-click menu, then the '.NET Components' tab,
then 'Browse...' and pick the assembly containing the control).
 
J

Jason (Kusanagihk)

To Dmitriy,

I don't know how to set the "ToolboxAttribute" to the control class;
can you list out the steps ?

BTW, I've found a tutorial on writing design time control to facilitate
IDE drag drop; but when I follow the tutorial the end result is the
Design Time control can't be added into the ToolBar (the error saids
this dll has some dependecies with something and can't be loaded
without them -- didn't list out what's missing)

Thx!
 
D

Dmitriy Lapshin [C# / .NET MVP]

Jason,

I am sorry, I misspelled the attribute name. Here's an example from MSDN:

[ToolboxBitmap(@"C:\Documents and Settings\Joe\MyPics\myImage.bmp")]
class MyControl2 : UserControl
{
}

You can find more infromation in the "Providing a Toolbox Bitmap for Your
Control" article in the "Visual Basic and Visual C# Concepts" section of
MSDN Library.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top