Draw Slightly Transparent Blue Rectangle in Native Win32 GDI
c++, gdi, winapi
Solution
You need to use the AlphaBlend function - http://msdn.microsoft.com/en-us/library/windows/desktop/dd183351(v=vs.85).aspx http://www.codeproject.com/Articles/286/Using-the-AlphaBlend-function
Problem
How do I draw a blue rectangle with a alpha/transparency value of 0.5 (ie, 50% transparency) in Native Win32 C++? Using a macro like RGBA() fails, I'm not sure how I can specify the alpha value of the brush. ``` SetDCPenColor(hdc, RGBA(255,255,0,127)); SetDCBrushColor(hdc, RGBA(255,255,0,127)); Rectangle(hdc, 0, 0, width, height); ```