Bitmap on UserControl

Hi all,

I've created my own userControl, and I would like to have my own image (that appears in the toolbox).
So, I've seen that I've to use ToolboxBitmap ...; but, I've never seen what to do after.
I never achived to see my own image.

I'm using :

[ToolboxBitmap(myUserControl::typeid, "
myUserControl.bmp")]

myUserControl.bmp is a 16x16x256 bitmap file. I try to put it in the ressources, out of the ressources. But I never seen my own bitmap
How to compile it with the dll

If i use an existing control (for example : [ToolboxBitmap(System::Windows::Forms::Button::typeid)] ), this is working well.

Thanks for helping me having my own image in the toolbox for my control

Best regards,


Nicolas


Answer this question

Bitmap on UserControl

  • Vibhore

    I finally achieve to make it working. For thoses who encounter the same problem, this is how you should do :

    • Create a 16x16 bitmap.
    • Name it as follow Namespace.ClasseName.bmp.
    • Add it as resource : Right Click on project --> Add --> Resource --> Import (bitmap).
    • Link it with the DLL. Right Click on project --> Properties --> Linker --> Input --> Embed Managed Resource File --> and put the name of the bitmap.
    • Rebuild all.
    And use the ToolBoxBitmap as follow :
    [ToolboxBitmap(namespace:UserControl::typeid)]

  • Bitmap on UserControl