Transparent background

This is a discussion on Transparent background within the Windows Programming forums, part of the Platform Specific Boards category; I would like to make my static control have transparent background. And how can I make the same thing with ...

  1. #1
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318

    Transparent background

    I would like to make my static control have transparent background. And how can I make the same thing with edit control?
    This doesn't seem to work:
    Code:
    hdc=GetDC(staticcontrolhwnd);
    SetBkMode(hdc,TRANSPARENT);
    ReleaseDC(staticcontrolhwnd,hdc);
    Last edited by maxorator; 11-02-2005 at 08:17 AM.

  2. #2
    Registered User
    Join Date
    Mar 2005
    Posts
    135
    MSDN:
    The SetBkMode function sets the background mix mode of the specified device context. The background mix mode is used with text, hatched brushes, and pen styles that are not solid lines.


    This functin doesn't pertain to true "window" transparency as you imagine.

    And here's how: Making any application transparent in Windows 2000/XP

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    You got me wrong. I want to use it with a static control, so the text will be visible and the background of the static control is transparent.

  4. #4
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Solved, I had the wrong hdc...
    I used it in a WM_CTLCOLORSTATIC:
    Code:
    case WM_CTLCOLORSTATIC:
        SetBkMode((HDC)lParam,TRANSPARENT);
        return (LRESULT)CreateSolidBrush(RGB(0, 74, 239));
    I used lParam as the hdc, but actually wParam was the hdc, lParam was the handle:
    Code:
    case WM_CTLCOLORSTATIC:
        SetBkMode((HDC)wParam,TRANSPARENT);
        return (LRESULT)CreateSolidBrush(RGB(0, 74, 239));
    Thanks for your help.

  5. #5
    Registered User
    Join Date
    Mar 2005
    Posts
    135
    Ah, ok. Glad you got it all sorted out then.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Transparent, Editbox, HOLLOW_BRUSH, Marking text?
    By Dampy in forum Windows Programming
    Replies: 6
    Last Post: 09-22-2008, 08:17 PM
  2. Transparent panels overlapped
    By AtomRiot in forum C# Programming
    Replies: 3
    Last Post: 04-21-2007, 10:16 PM
  3. Transparent toolbar buttons
    By stickman in forum Windows Programming
    Replies: 18
    Last Post: 10-08-2006, 11:30 AM
  4. Transparent bitmaps
    By Mithoric in forum Windows Programming
    Replies: 5
    Last Post: 03-11-2004, 03:14 PM
  5. Transparent Bitmap - inserting into richeditctrl
    By LuckY in forum Windows Programming
    Replies: 1
    Last Post: 08-06-2003, 01:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21