473,734 Members | 2,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create an Icon object with multiple images by GDI++ .

Hello ,
Please teach me how to create an Icon object with multiple images by GDI++ .
I can create an Icon with a image as following , but can't do an Icon with
multiple images.

private Icon ReturnIcon()
{
Bitmap Cbitmap = new Bitmap(32, 32, PixelFormat.For mat64bppPArgb);
Graphics gc = Graphics.FromIm age(Cbitmap);
//
//draw something on Cbitmap.
//
gc.Dispose();
Cbitmap.MakeTra nsparent(Color. White);
System.IntPtr icH = Cbitmap.GetHico n();
Icon ico = Icon.FromHandle (icH);
Cbitmap.Dispose ();
return ico;
}

Nov 16 '05 #1
2 4495
You might want to read this article:
http://www.codeproject.com/dotnet/MultiIcon.asp

-- Ricky Lee
=============== =============== =============== =====
^o^ "When all doors are closed, God will open a Windows" ^o^
=============== =============== =============== =====
"Netian" <Ne****@sample. com> wrote in message
news:uz******** *****@TK2MSFTNG P10.phx.gbl...
Hello ,
Please teach me how to create an Icon object with multiple images by GDI++ .. I can create an Icon with a image as following , but can't do an Icon with
multiple images.

private Icon ReturnIcon()
{
Bitmap Cbitmap = new Bitmap(32, 32, PixelFormat.For mat64bppPArgb);
Graphics gc = Graphics.FromIm age(Cbitmap);
//
//draw something on Cbitmap.
//
gc.Dispose();
Cbitmap.MakeTra nsparent(Color. White);
System.IntPtr icH = Cbitmap.GetHico n();
Icon ico = Icon.FromHandle (icH);
Cbitmap.Dispose ();
return ico;
}

Nov 16 '05 #2
Mr. Ricky Lee ,
Thank you for your kindness !!
This issue should certainly be settled by your advice soon.

Really, I knew '^o^ "When all doors are closed, God will open a Windows"
^o^'.

"Ricky Lee" <de****@benzine .com> wrote in message
news:42******** *************** @news.wanadoo.n l...
You might want to read this article:
http://www.codeproject.com/dotnet/MultiIcon.asp

-- Ricky Lee
=============== =============== =============== =====
^o^ "When all doors are closed, God will open a Windows" ^o^
=============== =============== =============== =====
"Netian" <Ne****@sample. com> wrote in message
news:uz******** *****@TK2MSFTNG P10.phx.gbl...
Hello ,
Please teach me how to create an Icon object with multiple images by
GDI++

.
I can create an Icon with a image as following , but can't do an Icon
with
multiple images.

private Icon ReturnIcon()
{
Bitmap Cbitmap = new Bitmap(32, 32, PixelFormat.For mat64bppPArgb);
Graphics gc = Graphics.FromIm age(Cbitmap);
//
//draw something on Cbitmap.
//
gc.Dispose();
Cbitmap.MakeTra nsparent(Color. White);
System.IntPtr icH = Cbitmap.GetHico n();
Icon ico = Icon.FromHandle (icH);
Cbitmap.Dispose ();
return ico;
}



Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3730
by: Terry | last post by:
There are a number of things about using unmanaged resources in Windows Forms programming that is unclear to me. In C++, if you loaded an icon resource using "ExtractIcon()", the resource was valid until you called "DestroyIcon()". If you didn't, you had a leak. In C#, I need to load icons from unmanaged programs (.exe, dll) at run time and I want to make sure I'm not leaking resources, but it's not clear to me how to insure that I'm...
4
1704
by: Arda Coskun | last post by:
Hi, How to create embedded graphics and audios? Any article would be helpful. Kind regards,
3
1764
by: Ravi Shankar | last post by:
Hi, I have a windows form application it uses AxShDocVw AxWebBrowser control. The control navigates to web pages at a specified interval set in Timer control. The form uses a notify icon. On axWebBrowser_DocumentComplete event I call a function which calls GetHiCon()(Icons handle). This function works fine for upto to about 2 hrs then the application throws Interop (Generic GDI+ exception). Any idea why this happens. Please excuse me if...
3
417
by: Richard Skopal | last post by:
In .NET Windows forms I can create a metafile using this code: Graphics grph = aControl.CreateGraphics(); IntPtr ipHDC = grph.GetHdc(); Metafile mf = new Metafile(aImgFilePath, ipHDC, EmfType.EmfOnly); grph.ReleaseHdc(ipHDC); grph.Dispose(); grph = Graphics.FromImage(mf); grph.DrawRectangle(aPen, 10, 10, 100, 120); grph.Dispose();
3
7073
by: Giuseppe Pezzella | last post by:
Hi In Windows every file have yours icon, so: how I get them ( Extension and Icon) and save in a imageList for use later in a ListView? In VB6 was SHGetFileInfo. In VB.NET? How I can obtain a CDROM letters? (D:/, E:/ ecc.)
4
1609
by: Pawel | last post by:
Hello I've a problem with DataGrid and Icon. Incons are in DataGrid's cells next to the other data. And now. When i cklick this icon i want to change icon without reload site. How to do this? Below part of code.
4
3665
by: =?Utf-8?B?dmluZWV0?= | last post by:
In WPF (even with considerable improvement in version 3.5), while running multiple animations in a single window, The performance of one animation suffers a lot. for example, i have two image transitions on two independent Canvases on a Grid. 1. is simple, slide transformation running, continously from left to right with multiple images. 2. 3D transitions over multiple images.
7
2343
by: =?Utf-8?B?QmVu?= | last post by:
Hi I am looking for a way to extraxt an icon from a .exe file an save it as an icon not a bitmap or jpeg to a file? The code below extracts the icon but only as a bitmap PictureBox1.Image = Drawing.Icon.ExtractAssociatedIcon("file.exe").ToBitmap The problem is I need the icon not the bitmap.
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9182
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.