I need to create bitmap buttons with round edges.
My forms have a bitmap as backgound and not one solid color.
So I have to make my Bitmap button with transparent color.
I created a png image with transparency and in my user control(for the button) I define the background color as Color.Transparent.
In the visual studio it looks great but when I run the application on the PDA I do not have any transparency not for the png image and not for the user control background is there any good solution for this

How can I draw transparent background on using pocket pc 5.0
ReiXou
hi buddy,
how can u solve that transparent picture box....................
can u possible to give idea
best49erfan
Hi,
I have included some code to help you (and anyone else) with this.
Firstly you will need to import Drawing.Imaging
using
System.Drawing.Imaging;Next you will need to override the Paint method
protected
override void OnPaint(PaintEventArgs e){
}Within the Paint method you should assign your image (png, gif, etc) to a Bitmap object. The code below assumes that you have added your image to the Resources and the Image name is MyImage.
protected override void OnPaint(PaintEventArgs e)
{
Bitmap bmp = new Bitmap(Properties.Resources.MyImage);
}
Next you can include the two methods below which you will pass in your Bitmap image. The first requires 4 parameters; your Bitmap, the x & y point where you want your image to appear, and e which already exists within the Paint method. You would use this method if the upper-left pixel of your image was the transparency color.
private
void DrawTransparentImage(Bitmap bmp, int x, int y, PaintEventArgs e){
//Get the transparency color key based on the upper-left pixel of the image //and pass into the full DrawTransparentImage methodDrawTransparentImage(bmp, x, y, e, bmp.GetPixel(0, 0));
}
The second DrawTransparentImage method allows you to pass in a specific transparency color (if the upper-left pixel of your image didn't contain the transparency color)
private
void DrawTransparentImage(Bitmap bmp, int x, int y, PaintEventArgs e, Color transparencyColor){
ImageAttributes attr = new ImageAttributes(); // Set the transparency color.attr.SetColorKey(transparencyColor, transparencyColor);
// Draw the image using the image attributes. Rectangle dstRect = new Rectangle(x, y, bmp.Width, bmp.Height);e.Graphics.DrawImage(bmp, dstRect, 0, 0, bmp.Width, bmp.Height,
GraphicsUnit.Pixel, attr);}
Below is an example of calling the DrawTransparentImage method(s).
protected override void OnPaint(PaintEventArgs e){
Bitmap bmp1 = new Bitmap(Properties.Resources.MyImage1); Bitmap bmp2 = new Bitmap(Properties.Resources.MyImage2); Bitmap bmp3 = new Bitmap(Properties.Resources.MyImage3); //The upper-left pixel contains the transparency color for this imageDrawTransparentImage(bmp1, 10, 10, e);
//The transparent color for this image is Green (0, 255, 0), or any other specific color you wantDrawTransparentImage(bmp2, 20, 20, e,
Color.FromArgb(0, 255, 0)); //The transparent color for this image is GreenDrawTransparentImage(bmp3, 30, 30, e,
Color.Green);}
Hope this helps you (and others)
Cheers,
Grant.
andien_geo
Vivek Natani