Solved

Icon Not Appearing In Winform header - Visual Studio 2008

Posted on 2010-08-13
5
549 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
ID: 33432051
No icon for the display colourdepth on the screen ?
0
 

Author Comment

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

Accepted Solution

by:
AndyAinscow earned 250 total points
ID: 33432485
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
ID: 33434982
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
ID: 34962444
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

785 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