icon for UserControl

  • Thread starter Thread starter Pascal
  • Start date Start date
P

Pascal

Hi all,

I'd tried to follow the instructions from msdn for adding icon image for a
control. I've checked the name of bmp file is same as the control name
and turn the bmp file to "Embedded Resource". After building the project
again, the icon of my user control is the same as default. I'm not sure it's
related to my VB.Net version is an express edition or not? Anyone know
what's wrong ?
I did this :
Created a 16 x 16 pixd (256 colors)
gave it the name of the class (MonLabel->
"MonLabel.bmp"). Then added the bitmap to the project and set its build
action to embedded resource.
Extended my code like this:

Imports System.ComponentModel
<ToolboxBitmap(GetType(MonLabel), "MonLabel.bmp")> _
Public Class MonLabel
Inherits Windows.Forms.Label


Thanks
pascal
 
Hi Pascal,

You have to enter the fully-qualified name of the resource file
(MonLabel.bmp) which includes your project namespace (consult your Project
Properties for the namespace). E.g. it would then be:

<ToolboxBitmap(GetType(MonLabel), "ProjectNamespace.MonLabel.bmp")> _
 
Pascal said:
Hi all,

I did this :
Created a 16 x 16 pixd (256 colors)

No help with the dotNet stuff, but thought I'd mention.... in VB6, anyway,
that 16x16 (it says "16x15, scaled if necessary" in VB6) is the "toolbox"
size of your bitmap... which means you can work with 64x64 if you want and
it'll be scaled down automatically, so it shows in the toolbox...

I've never been able to create anything in 16x16 that looked decent. 32x32's
about as low as I can go. No "256 color" restrictions, either.
 
Back
Top