Solved

Icon Not Appearing In Winform header - Visual Studio 2008

Posted on 2010-08-13
5
561 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
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
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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