Prev: CAB-Installer
Next: Forum?
From: Peter Carlson on
I have searched all the articles and tried various things, but cant seem
to get this to work. CF 3.5 targetting Winmo 6+. I have a png in a
picturebox. Then I have another png that is transparent. the
background is a compass frame and the foreground is the compass rose. I
update the image like this:

Bitmap b2 = Properties.Resources.pngRose;
Graphics gpCompass = Graphics.FromImage(pbCompass.Image);
gpCompass.DrawImage(b2, 0, 0,
new Rectangle(0, 0, b2.Width, b2.Height),
GraphicsUnit.Pixel );
pbCompass.Refresh();

However it draws the rose with a solid white background.

So I thought maybe I need to load the png from a file, but I am not sure
how to do this in the emulator?

So 2 questions:
1. can this be done by embedding the resource?
2. Where do I place the png in the file system of the project in order
to get it onto the emulator?

Peter
From: Markus Humm on
Hello,

has the PNG a alpha channel?

Greetings

Markus
From: Peter Carlson on
Yes,
I drew it in photoshop and it shows there as transparent as well in IE
and windows photo viewer. It is 32bpp

Peter

Markus Humm wrote:
> Hello,
>
> has the PNG a alpha channel?
>
> Greetings
>
> Markus
From: badzio on
On 17 Sty, 04:38, Peter Carlson <peter(a)h_o_w_u_d_o_d_a_t.com> wrote:
> I have searched all the articles and tried various things, but cant seem
> to get this to work.  CF 3.5 targetting Winmo 6+. I have a png in a
> picturebox.  Then I have another png that is transparent.  the
> background is a compass frame and the foreground is the compass rose.  

Hi, not sure how it works in CF 3.5. But in CF 2.0 transparent means
that background is taken from parent control.
You can implement transparency yourself or use some library :) I've
found alphamobilecontrols, it's on LGPL and works fine. But it's for
CF 2.0, you must check if it works on CF 3.5
From: Matt Evans on
Hi Peter

if I recall correctly, the problem you are seeing is because the .net
cf bitmap loaders don't respect the alpha channel. If you are using
WM5.0 or above you can use the GDI+ and the imaging library api to
load your png files with transparency.

Take a look at this blog post:

http://blog.opennetcf.com/afeinman/PermaLink,guid,e59ee005-91b0-4807-8142-22394b368826.aspx

The OpenNETCF SDF has managed wrappers for the imaging api, and I have
used that to successfully load my transparent png files from the file
system and then draw them to controls.

HTH

Matt

On Jan 17, 2:38 pm, Peter Carlson <peter(a)h_o_w_u_d_o_d_a_t.com> wrote:
> I have searched all the articles and tried various things, but cant seem
> to get this to work.  CF 3.5 targetting Winmo 6+. I have a png in a
> picturebox.  Then I have another png that is transparent.  the
> background is a compass frame and the foreground is the compass rose.  I
> update the image like this:
>
>    Bitmap b2 = Properties.Resources.pngRose;
>    Graphics gpCompass = Graphics.FromImage(pbCompass.Image);
>    gpCompass.DrawImage(b2, 0, 0,
>      new Rectangle(0, 0, b2.Width, b2.Height),
>      GraphicsUnit.Pixel );
>    pbCompass.Refresh();
>
> However it draws the rose with a solid white background.
>
> So I thought maybe I need to load the png from a file, but I am not sure
> how to do this in the emulator?
>
> So 2 questions:
> 1.  can this be done by embedding the resource?
> 2.  Where do I place the png in the file system of the project in order
> to get it onto the emulator?
>
> Peter

 |  Next  |  Last
Pages: 1 2
Prev: CAB-Installer
Next: Forum?