Thread: Draw a semi-transparent icon in winapi.

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    9

    Draw a semi-transparent icon in winapi.

    People.
    How can I draw a semi transparent icon in winapi with WM_PAINT ?
    I mean i'm using functions like
    Code:
    HICON hIconPic =  LoadImage(_hInstance, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 320, 240, LR_LOADTRANSPARENT);
    HDC dcIconPic = CreateCompatibleDC(0);
    HICON hSecondIcon = (HICON)SelectObject(dcIconPic, hIconPic);
    DrawIconEx(ps.hdc, 0, 0, hIconPic, 0, 0, 0, NULL, DI_NORMAL );
    to draw an Icon in winapi window, but the transparency of the icon image is only fully transparent.
    Semi-transparency doesn't work ! The semi transparency shown as white color. Can it be implemented somehow easily?

  2. #2
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    I don't think so. The icon alpha channel isn't natively supported in XP and below. You'll have to make your own function for that, or install a library or graphics engine of some kind.

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    Quote Originally Posted by Yarin View Post
    I don't think so. The icon alpha channel isn't natively supported in XP and below. You'll have to make your own function for that, or install a library or graphics engine of some kind.
    No, use Win32 Shell apis

  4. #4
    Registered User
    Join Date
    Jun 2009
    Posts
    9
    Quote Originally Posted by Alex31 View Post
    No, use Win32 Shell apis
    can you please explain ?
    wich of the API can do this ?

    thanks

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    Several methods (see on Win32 grp, Sh. , C. Controls, etc)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. icon draw app
    By Gordon in forum Windows Programming
    Replies: 1
    Last Post: 04-05-2007, 04:24 AM
  2. Which is the better way to draw?
    By g4j31a5 in forum Game Programming
    Replies: 16
    Last Post: 01-22-2007, 11:56 PM
  3. draw function HELP!!!
    By sunoflight77 in forum C++ Programming
    Replies: 1
    Last Post: 05-10-2005, 11:28 PM
  4. Transparent Draw Question
    By GodLike in forum Windows Programming
    Replies: 5
    Last Post: 05-07-2002, 06:56 AM
  5. icon in title bar?
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 12-12-2001, 06:43 PM