473,382 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Form Icon

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
5 7620
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
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

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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Vic | last post by:
I am trying to change an icon associated with my application's main form and the application itself. 1. I selected my main form in IDE "Solution" tab and went to "Properties" window. 2. I found...
4
by: Dan Sikorsky | last post by:
How do you set the this.Icon property of a windows form to the App.ico file specified in the Project Properties? I don't want to type in the path and filename; I want to set the form's icon...
7
by: Danielb | last post by:
I want my application to run most of the time as just an notify icon visible in the system tray, with some dialogs windows that open if the user selects an option from the context menu on the tray...
6
by: Lespaul36 | last post by:
I am new to the .Net but not new to VB, but I am having problems with the form icon. I made an icon file using VS.Net 2003 and then added it to my form. The icon shows in the properties, but not...
3
by: QLD_AU | last post by:
Is their a way in a VB.Net application to set all sub form icons to the main form ? or even set all icons to the Application icon, without having to reference the icon as a filename ? With...
1
by: Thief_ | last post by:
I have two projects in one solution: a.. Outlook Monitor b.. Tray Notification Both contain a form called "Form1.vb". How do I reference "Outlook Monitor"'s Form1 from "Tray Notification"'s...
3
by: Nina | last post by:
Hi there, I assigned icon for a window's form using form's Icon property at design time. Now I want to change the icon. I tried to replace the old icon with the new icon using form's Icon...
5
by: Tom | last post by:
I have a main VB.NET application that loads another VB.NET DLL dynamically. Once I have done that, I would like to be able to 'get' the icon of a form in that dynamically loaded DLL. How would...
3
by: Raj Wall | last post by:
Hi, I have an application which, when running, is to be seen only in the system tray as a right-clickable icon. However I want the main Form window itself to immediately disappear without...
2
by: \(O\)enone | last post by:
I wish to be able to copy a form's icon into a picturebox, in a similar way to how the Windows Taskbar copies each form's icon into each of its task panels. I can easily read out the icon of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.