Home > Back-end >  TransparentBlt display images, but not transparent
TransparentBlt display images, but not transparent

Time:11-02

G_hdc=GetDC (HWND);
G_hCharacter1=(HBITMAP) LoadImage (NULL, "character1. BMP," L IMAGE_BITMAP, 535650, LR_LOADFROMFILE);
G_mhdc=CreateCompatibleDC (g_hdc);
SelectObject (g_mhdc g_hCharacter1);
TransparentBlt (g_hdc, 0, WINDOW_HIIGHT - 650535650, g_mhdc, 0,0,535,650, RGB (0, 0));
ReleaseDC (HWND, g_hdc);

Can display pictures, pictures showed around are black, black can be transparent is not make, why?

CodePudding user response:

Display picture is black around
-- -- -- -- -- -- -- -- -- --
Open the image with the PS see RGB value, is not necessarily a RGB (0, 0),

CodePudding user response:

Transparent Windows look at:
LONG style=: : GetWindowLong (m_hWnd, GWL_EXSTYLE);
Style |=WS_EX_LAYERED;
Style=: : SetWindowLong (m_hWnd, GWL_EXSTYLE, style);
SetLayeredWindowAttributes (RGB (0, 0, 0), 1, 1);
  • Related