How can you access icons from a Multi-Icon (.ico) file using index in C#

前端 未结 2 1177
南方客
南方客 2020-12-20 16:47

I want to use the 4th image from the ico file : C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\Common7\\VS2008ImageLibrary\\1033\\VS2008ImageLi

2条回答
  •  [愿得一人]
    2020-12-20 17:02

    You'll need to manually parse through the .ico file grabbing information from the header (see here for a layout of the .ico file type).

    There's an open source project on vbAccelerator (don't worry it's actually c# code, not VB) that uses the Win32 API to extract icons from resources (exe, dll and even ico, which is what you are looking to do). You could either use that code or go through it for an good idea of how it is done. The source code can be browsed here.

提交回复
热议问题