Ein Fenster transparent malen

// Aufruf in der OnPaint-Methode: z.b. maketransparent(Handle, 20);
void maketransparent(HWND AHandle, int ABlending)
{
    SetWindowLong(AHandle, GWL_EXSTYLE,GetWindowLong(AHandle, GWL_EXSTYLE) | WS_EX_LAYERED);
    SetLayeredWindowAttributes(AHandle, 0,(255*ABlending)/100, LWA_ALPHA);

    BLENDFUNCTION blend;
    blend.BlendOp = AC_SRC_OVER;
    blend.BlendFlags = 0;
    blend.AlphaFormat = 0;
    blend.SourceConstantAlpha = AC_SRC_ALPHA ;
    UpdateLayeredWindow(AHandle, NULL, NULL, NULL, NULL, NULL,NULL, &blend, ULW_ALPHA);
}

Schreibe einen Kommentar