i've implemented a owner draw button into my win32 app (no MFC). The button is a normal 20x20 bitmap (round icon with transparency). The problem is that the button is positioned on a solid background and i can see the buttons gray background (since the bitmap is round). I've tried responding to WM_CTLCOLORBTN with NULL_BRUSH but no luck.. I've tried displaying the button using a bitmap and a ico file but wont budge.. Does anyone know how to solve this problem?

This is my problem, the settings icon should be transparent at the edges (not white/gray)

enter image description here

有帮助吗?

解决方案

In addition to what @joel's answer, if you want to make some area transperant put a unique color in the area where you want to have transperancy using some image editors (RGB(0xFF,0x00,0xFF)) is mostly used Then use TransperantBlt

其他提示

It sounds like you're trying to make a non-rectangular control.

You could call SetWindowRgn to tell Windows that your control is non-rectangular.

You say it's a solid background but your image shows some kind of orange-yellow gradient as a background. If it really was a standard windows button solid color you can load the bitmap with LoadImage using the LR_LOADMAP3DCOLORS or LR_LOADTRANSPARENT. Since you have a gradient you'll have to use a more complicated technique to mask out the bitmap. http://www.winprog.org/tutorial/transparency.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top