Draw a Transparent Icon

Daed
Daed used Ask the Experts™
on
How can I draw a transparent Icon without using DrawIcon function. I don’t want to use DrawIcon because it didn’t limit the width and height of the Icon in the DC. So I need a method that can draw a transparent icon within certain width and height.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Use function DrawIndirect of CImageList

Good Luck

Author

Commented:
DrawIndirect does not clip the icon, it draws it according to the width and height values passed in the parameter, so if I passed a smaller height the icon will be shrank to fit this height. What I need is to clip the icon according to the height and width I need.
Commented:
I haven't tested this but it seems to be worth a try. You can still use DrawIcon but before that, call GetDCEx to retrieve a DC that you can attach a clipping region to. This may work for your problem.

.f

Author

Commented:
I am trying GetDCEx function, it is not working with me, I am not sure if I am using the correct flag. Can you help me in this?

Commented:
Since I never really used this, I will have to guess just as much as you do. I would recommend specifying the DCX_INTERSECTRGN flag at any rate. If someone has experience with GetDCEx, please respond to this thread.

.f

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial