CF Toolbar buttons with Transparency?

A

Anatoly

I am trying to draw some toolbar images that have transparent pixels on the
sides - so that it blends in with the toolbar color,

I tried both bitmaps and Icons.

bitmaps don't even have a "transparent color", and ImageList on CF doesn't
support such color setting.

Icons support transparent color (picker shows it as a gree-screen monitor
drawn inside the color pick), and it also supports the auto forecolor (same
pick as above but pink in color). With icons, any pixels drawn as those auto
colors show up as white.

I tried both 16x16x16 colors and 16x16x256 colors - the work the same way.

The behaviour shows on both emulator (v 4.1.0) and a real device (toshiba
e755).

In this post of Feb 7 2003, at this URL it is being suggested to use Icons,
am I doing something wrong?

http://groups.google.com/groups?hl=...G.188d444723bae388989680%40news.microsoft.com


-Anatoly
 
D

David So [MSFT]

This is a bug in designer in Visual Studio 2003 that would spit incorrect
code and makes icon not transparent, one of the way you can to do is to add
the icon file to the imagelist outside InitializeComponent and add the icon
files to the project as context so that it will get downloaded to the
device, here is some sample code to add the icon.

private void Form1_Load(object sender, System.EventArgs e)
{
string iconpath = "\\Program Files\\SmartDeviceApplication1\\";
this.imageList1.Images.Add(new
System.Drawing.Icon(System.IO.File.Open(iconpath +
"notepad.ico",System.IO.FileMode.Open)));
this.toolBarButton1.ImageIndex = 0;
}

Let me know if you still have trouble getting icon transparency.

Thanks,

David

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Anatoly" <[email protected]>
| Subject: CF Toolbar buttons with Transparency?
| Date: Mon, 27 Oct 2003 23:02:35 -0500
| Lines: 27
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 207-237-242-132.c3-0.nyw-ubr2.nyr-nyw.ny.cable.rcn.com
207.237.242.132
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:36992
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| I am trying to draw some toolbar images that have transparent pixels on
the
| sides - so that it blends in with the toolbar color,
|
| I tried both bitmaps and Icons.
|
| bitmaps don't even have a "transparent color", and ImageList on CF doesn't
| support such color setting.
|
| Icons support transparent color (picker shows it as a gree-screen monitor
| drawn inside the color pick), and it also supports the auto forecolor
(same
| pick as above but pink in color). With icons, any pixels drawn as those
auto
| colors show up as white.
|
| I tried both 16x16x16 colors and 16x16x256 colors - the work the same way.
|
| The behaviour shows on both emulator (v 4.1.0) and a real device (toshiba
| e755).
|
| In this post of Feb 7 2003, at this URL it is being suggested to use
Icons,
| am I doing something wrong?
|
|
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=MPG.188d
444723bae388989680%40news.microsoft.com&rnum=1&prev=/groups%3Fhl%3Den%26lr%3
D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3DMPG.188d444723bae388989680%2540news.mic
rosoft.com
|
|
| -Anatoly
|
|
|
 
A

Anatoly

thanks, David, you put me on the right track,
To obtain the icons from resouce, this seems to have worked:

this.imageList1.Images.Add(new
Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream(
"imagebuttontest.images.testicon1.ico")));

-Anatoly
 

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