By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,891 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,891 IT Pros & Developers. It's quick & easy.

Form Icon

P: n/a
I have a form , I want to change form icon relate to some states,
I all image list witch include some icons.
How can I convert image to Icon or how to change the form icon ....in run time
Nov 16 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Here is some code to convert image to icons:
FileStream fs = new FileStream(@"C:\image.bmp",System.IO.FileMode.Open );
Image img = Image.FromStream(fs);
FileStream mStr = new
FileStream(@"C:\testsmall.jpg",System.IO.FileMode. Create );
Image imgThumb= img.GetThumbnailImage(100,100,null,new IntPtr());

imgThumb.Save(mStr,System.Drawing.Imaging.ImageFor mat.Jpeg);
mStr.Close();
fs.Close();

You can modify it.
To change icon of form just use YouForm.Icon = youicon; in runtime

Hope that helps
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"[Yosi]" <Yo**@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
I have a form , I want to change form icon relate to some states,
I all image list witch include some icons.
How can I convert image to Icon or how to change the form icon ....in run

time
Nov 16 '05 #2

P: n/a
Hi Tamir,

I tried your code, but i found that there is no ICON encoder
(bmp & Jpeg doesn't seem to work).
Could you give us any working example?

Cheers!

Marcin
Here is some code to convert image to icons:
FileStream fs = new FileStream(@"C:\image.bmp",System.IO.FileMode.Open );
Image img = Image.FromStream(fs);
FileStream mStr = new
FileStream(@"C:\testsmall.jpg",System.IO.FileMode. Create );
Image imgThumb= img.GetThumbnailImage(100,100,null,new IntPtr());

imgThumb.Save(mStr,System.Drawing.Imaging.ImageFor mat.Jpeg);
mStr.Close();
fs.Close();

You can modify it.
To change icon of form just use YouForm.Icon = youicon; in runtime

Hope that helps

Nov 16 '05 #3

P: n/a

this.Icon=new Icon(ProjecrtModules.AppPath+"\\Open.ico");

"Marcin Grzębski" wrote:
Hi Tamir,

I tried your code, but i found that there is no ICON encoder
(bmp & Jpeg doesn't seem to work).
Could you give us any working example?

Cheers!

Marcin
Here is some code to convert image to icons:
FileStream fs = new FileStream(@"C:\image.bmp",System.IO.FileMode.Open );
Image img = Image.FromStream(fs);
FileStream mStr = new
FileStream(@"C:\testsmall.jpg",System.IO.FileMode. Create );
Image imgThumb= img.GetThumbnailImage(100,100,null,new IntPtr());

imgThumb.Save(mStr,System.Drawing.Imaging.ImageFor mat.Jpeg);
mStr.Close();
fs.Close();

You can modify it.
To change icon of form just use YouForm.Icon = youicon; in runtime

Hope that helps

Nov 16 '05 #4

P: n/a
this.Icon = Icon.FromHandle(new Bitmap(imageList1.Images[0]).GetHicon());

This works ;)
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Marcin Grzębski" <mg*******@taxussi.no.com.spam.pl> wrote in message
news:cb**********@nemesis.news.tpi.pl...
Hi Tamir,

I tried your code, but i found that there is no ICON encoder
(bmp & Jpeg doesn't seem to work).
Could you give us any working example?

Cheers!

Marcin
Here is some code to convert image to icons:
FileStream fs = new FileStream(@"C:\image.bmp",System.IO.FileMode.Open ); Image img = Image.FromStream(fs);
FileStream mStr = new
FileStream(@"C:\testsmall.jpg",System.IO.FileMode. Create );
Image imgThumb= img.GetThumbnailImage(100,100,null,new IntPtr());

imgThumb.Save(mStr,System.Drawing.Imaging.ImageFor mat.Jpeg);
mStr.Close();
fs.Close();

You can modify it.
To change icon of form just use YouForm.Icon = youicon; in runtime

Hope that helps

Nov 16 '05 #5

P: n/a
Hi Tamir,
this.Icon = Icon.FromHandle(new Bitmap(imageList1.Images[0]).GetHicon());


Thank You!

I tried to do the same, but in much (much...) more complicated way.
:)

Regards

Marcin
Nov 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.