Try this out:
1. Create a project called "WindowsApplication1"
2. Add an icon called "MSN.ICO" to the project
3. In the properties for the icon (click on it in the solution explorer),
select "Embedded Resource" for "Build Action"
4. Open Form1
5. Add a toolbar, and then a toolbarbutton in the toolbar
6. Add an imagelist component
7. Add the following in the constructor for the Form _AFTER_ the call to
InitializeComponent.
Icon icon = new
Icon(this.GetType().Module.Assembly.GetManifestResourceStream("WindowsApplic
ation1.MSN.ICO"));
this.imageList1.Images.Add(icon);
this.toolBar1.ImageList = this.imageList1;
this.toolBarButton1.ImageIndex = 0;
you should then see the icon with transparency correctly applied to the
button on your toolbar.
-Ben
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Boris Nienke <
[email protected]>
| Subject: Re: Toolbar: Bitmaps with transparent Background?
| MIME-Version: 1.0
| Content-Type: text/plain; charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| References: <
[email protected]>
<
[email protected]>
| Date: Wed, 20 Aug 2003 10:43:05 +0200
| Message-ID: <
[email protected]>
| User-Agent: 40tude_Dialog/2.0.5.1
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 217.5.221.2
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:31416
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| :'( too sad... but good to know that it isn't me who did something wrong
|
| BTW: do have an example on how to load the bitmaps manually to the
| toolbar-buttons?
|
| thank you
|
| Boris
|
| On Mon, 18 Aug 2003 22:48:57 GMT, Benjamin Wulfe wrote:
|
| > You may be experiencing a problem with the way ImageList objects are
stored
| > to the applications .resources. Currently, icons added to an ImageList
| > lose thier transparency key if they are added to an imagelist on a
form.
| > To get around this, you should add the icon at the project level and
| > manually load it to your toolbar button after InitializeComponent has
been
| > called.
| >
| > -Ben
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| > --------------------
| >|
| >| Hi,
| >|
| >| how to draw small toolbar-icons (16x16 pixels) with transparency?
| >| Currently all my icons have a white background which doesn't look
| >| good...
| >|
| >| Boris
| >|
|