Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 588
  • Last Modified:

Icon Not Appearing In Winform header - Visual Studio 2008

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
jamesdean666
Asked:
jamesdean666
  • 2
  • 2
2 Solutions
 
AndyAinscowCommented:
No icon for the display colourdepth on the screen ?
0
 
jamesdean666Author Commented:
I'm sorry AndyAinscow.. I'm not clear on what you're saying.. :)
0
 
AndyAinscowCommented:
Your monitor is set for a colour depth eg. 32 bit - does the icon actually contin a picture at that setting ?
0
 
Vikram Singh SainiSoftware Engineer cum AD DeveloperCommented:
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
 
jamesdean666Author Commented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now