Solved

Icon Not Appearing In Winform header - Visual Studio 2008

Posted on 2010-08-13
5
544 Views
Last Modified: 2013-11-26
I have tried to place an Icon in a Winform header, I have done this before by selecting the graphic - with and .ico extension, as the Icon for a Form.. For some reason it is not displaying for this project...

Any ideas?  Thanks!
0
Comment
Question by:jamesdean666
  • 2
  • 2
5 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
No icon for the display colourdepth on the screen ?
0
 

Author Comment

by:jamesdean666
Comment Utility
I'm sorry AndyAinscow.. I'm not clear on what you're saying.. :)
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 250 total points
Comment Utility
Your monitor is set for a colour depth eg. 32 bit - does the icon actually contin a picture at that setting ?
0
 
LVL 16

Assisted Solution

by:Vikram Singh Saini
Vikram Singh Saini earned 250 total points
Comment Utility
Hi,

The reason your icon is not visible in Window Forms header could be that your Icon(.ico) file is corrupted. Or your program is not able to access resources from Resource as:

this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

Please check code for setting image as icon or icon as icon.

Regards,
V.S.Saini

private void Form1_Load(object sender, EventArgs e)
        {
            //1// Set icon from icon file as
            Icon ico = new Icon(@"D:\Zodes\g.ico");
            this.Icon = ico;

            //2// Set image as icon
            Bitmap bmp=new Bitmap(@"D:\Zodes\s.jpg");
            this.Icon = Icon.FromHandle(bmp.GetHicon());

        }

Open in new window

0
 

Author Closing Comment

by:jamesdean666
Comment Utility
The issue was actually the fact that I was hiding the Windows buttons, i.e. close, max, min.

Once I made them visible, my icon appears.

Thanks all.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now