syhzaidi

hi..

well it is a problem here that i have loaded a bitmap on a form ....now the problem is that my bitmap is a polygon type ....means it has a artistic look...which has not squared cornors....means that how and that cornor are white....and they are also coming on the screen..............now i make u undertand that by a direct x example in direct x we make a image a racing car but the racing car....is a design not a squared image.....so how can i have the left background of image of racing car transparent so that only the racing car comes on the screen not the other left image.......

plz tell that u understood my problem,....




Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

lijgame

You can edit this picture in photoshop and set its background to transparent.



Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

syhzaidi

well thx....but can u tell me how to make it transparent in photoshop i not so much native to photoshop....so that the white background should not come in form while working in C# VS2005




Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

nobugz

Check this thread for a way to use Bitmap.MakeTransparent().





Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

syhzaidi

well thx for ur reply and apologise for making two thread......well i m paste my code here where i have my decalaration......problem is that i have decalred my image as a Image type not Bitmap therefore function Maketranparent is not working in it...so plz seee the code and make neccessary changes so that the white background should not come ....see it

public partial class Form1 : Form
{
private Image image;


public Form1()
{
InitializeComponent();
Refresh();
image = Image.FromFile("new.bmp");

}

private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics p = e.Graphics;
p.DrawImage(image, e.ClipRectangle);


}

so here u can see that it not Bitmap image.....but it is Image image...so can i make it transparent so plz make neccasry changes or any other way

best reagards






Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

nobugz

Bitmap.FromFile() does in fact return a Bitmap reference but you need to cast. Modify your code like this:

private Bitmap image;
...
image = (Bitmap)Bitmap.FromFile("new.bmp");






Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

syhzaidi

ok..thx it works....but now another problem occurs here....i told u...that...i have artistic design of form..which is bitmap..and i have loaded it on a form....now ...the white background has gone away but the form background comes behind my bitmap as form is also a square......i made it white...but it is of no use...i want the form should be only behind my bitmap now and it is coming all over....i have made button on it ...so they should come on bitmap...thx.

best regards






Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

syhzaidi

i mean here that the area which comes outside the needed area of form behind the bitmap should become.... transparent...




Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

nobugz

Umm, I've got trouble decoding your request. Guessing what you need: try something like setting the form's background to a color that doesn't appear in the bitmap, then set the form's TransparencyKey to that color...





Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

syhzaidi

ok i tell u again....i want the form should become transparent ii could not paste my bitmap here...if i could show u whats the problem..is .............listen carefully....there is a form...which is square shaped..ok...now....i have a bitmap....which is also square...so by ur answer...i made the bitmap...left white area to transparent....but the form behind that bitmap....comes...in squared form which is not transparent and i want it to be transparent...u imagine any win application..that can be on any shape...ok a eg media player of circle. shape....which has buttons...on it ,,,,those button has been created on it form na.....then but the form is square not a circle how a media player is of cirlce of rectangle shape or a free sixe shape....can be,,,so also want it like that application...




Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

syhzaidi

plz gave a coded example or...it u have....any tutorial example..ss




Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

nobugz

Umm, still not sure what you're looking for. Take a look at the Form.Region property, it allows you to give the form any shape you want.





Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

syhzaidi

what way i can tell and what uare not getting....well where is the region property located VS 2005.....i m not getting...frustrated here.............simply i want my application to be like.....curved rectangle and i have loaded the rectangle as bitmap image ....now the form which i behind the image is coming on the screen i want it to be transparent..




Re: Windows Forms General HI!!! well is there any way to load a custormise bitmap on a form!!!!!!!!!!how to make its background transparent!!!

syhzaidi

well plz anyone answer it.......i again ask a simple...thing in respect of my previous questions how can i make my form transparent and load a customerize bitmap on it.....thx