Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 539261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:07:03+00:00 2026-05-13T10:07:03+00:00

I have an application which I have made a 256 x 256 Windows Vista icon

  • 0

I have an application which I have made a 256 x 256 Windows Vista icon for.

I was wondering how I would be able to use a 256×256 PNG file in the ico file used as the application icon and show it in a picture box on a form.

I am using VB.NET, but answers in C# are fine. I’m thinking I may have to use reflection.

I am not sure if this is even possible in Windows XP and may need Windows Vista APIs

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:07:04+00:00Added an answer on May 13, 2026 at 10:07 am

    Today, I made a very nice function for extracting the 256×256 Bitmaps from Vista icons.

    Like you, Nathan W, I use it to display the large icon as a Bitmap in “About” box. For example, this code gets Vista icon as PNG image, and displays it in a 256×256 PictureBox:

    picboxAppLogo.Image = ExtractVistaIcon(myIcon);
    

    This function takes Icon object as a parameter. So, you can use it with any icons – from resources, from files, from streams, and so on. (Read below about extracting EXE icon).

    It runs on any OS, because it does not use any Win32 API, it is 100% managed code 🙂

    // Based on: http://www.codeproject.com/KB/cs/IconExtractor.aspx
    // And a hint from: http://www.codeproject.com/KB/cs/IconLib.aspx
    
    Bitmap ExtractVistaIcon(Icon icoIcon)
    {
        Bitmap bmpPngExtracted = null;
        try
        {
            byte[] srcBuf = null;
            using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                { icoIcon.Save(stream); srcBuf = stream.ToArray(); }
            const int SizeICONDIR = 6;
            const int SizeICONDIRENTRY = 16;
            int iCount = BitConverter.ToInt16(srcBuf, 4);
            for (int iIndex=0; iIndex<iCount; iIndex++)
            {
                int iWidth  = srcBuf[SizeICONDIR + SizeICONDIRENTRY * iIndex];
                int iHeight = srcBuf[SizeICONDIR + SizeICONDIRENTRY * iIndex + 1];
                int iBitCount   = BitConverter.ToInt16(srcBuf, SizeICONDIR + SizeICONDIRENTRY * iIndex + 6);
                if (iWidth == 0 && iHeight == 0 && iBitCount == 32)
                {
                    int iImageSize   = BitConverter.ToInt32(srcBuf, SizeICONDIR + SizeICONDIRENTRY * iIndex + 8);
                    int iImageOffset = BitConverter.ToInt32(srcBuf, SizeICONDIR + SizeICONDIRENTRY * iIndex + 12);
                    System.IO.MemoryStream destStream = new System.IO.MemoryStream();
                    System.IO.BinaryWriter writer = new System.IO.BinaryWriter(destStream);
                    writer.Write(srcBuf, iImageOffset, iImageSize);
                    destStream.Seek(0, System.IO.SeekOrigin.Begin);
                    bmpPngExtracted = new Bitmap(destStream); // This is PNG! :)
                    break;
                }
            }
        }
        catch { return null; }
        return bmpPngExtracted;
    }
    

    IMPORTANT! If you want to load this icon directly from EXE file, then you CAN’T use Icon.ExtractAssociatedIcon(Application.ExecutablePath) as a parameter, because .NET function ExtractAssociatedIcon() is so stupid, it extracts ONLY 32×32 icon!

    Instead, you better use the whole IconExtractor class, created by Tsuda Kageyu (http://www.codeproject.com/KB/cs/IconExtractor.aspx). You can slightly simplify this class, to make it smaller. Use IconExtractor this way:

    // Getting FILL icon set from EXE, and extracting 256x256 version for logo...
    using (TKageyu.Utils.IconExtractor IconEx = new TKageyu.Utils.IconExtractor(Application.ExecutablePath))
    {
        Icon icoAppIcon = IconEx.GetIcon(0); // Because standard System.Drawing.Icon.ExtractAssociatedIcon() returns ONLY 32x32.
        picboxAppLogo.Image = ExtractVistaIcon(icoAppIcon);
    }
    

    Note: I’m still using my ExtractVistaIcon() function here, because I don’t like how IconExtractor handles this job – first, it extracts all icon formats by using IconExtractor.SplitIcon(icoAppIcon), and then you have to know the exact 256×256 icon index to get the desired vista-icon. So, using my ExtractVistaIcon() here is much faster and simplier way 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application in which we use a hand-made build system.The reason for
Visual Studio 2010 Express, Windows Forms. Have made myself my first little application which
i have a windows application made in VB.NET which maintains a database, and i
I have made an application which uses latest ios facebook sdk to connect. I
I have made a sample application which constructs a filter graph to capture audio
I have made an iphone application like flip cards in which values of cards
I have made a swings application but there is one problem in that which
I have application which needs to use a dll (also written by me) which
I have a windows application which is published on a website and can be
I made an application and a dll, which are working this way: I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.