Made Labels on Windows transparent.
This commit is contained in:
parent
307577889e
commit
5ca3f0f0f9
|
@ -80,6 +80,8 @@ static LRESULT forwardNotify(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
// TODO give this a better name
|
// TODO give this a better name
|
||||||
BOOL sharedWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
BOOL sharedWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
||||||
{
|
{
|
||||||
|
DWORD exstyle;
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
*lResult = forwardCommand(hwnd, uMsg, wParam, lParam);
|
*lResult = forwardCommand(hwnd, uMsg, wParam, lParam);
|
||||||
|
@ -87,6 +89,15 @@ BOOL sharedWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
*lResult = forwardNotify(hwnd, uMsg, wParam, lParam);
|
*lResult = forwardNotify(hwnd, uMsg, wParam, lParam);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
case WM_CTLCOLORSTATIC:
|
||||||
|
exstyle = (DWORD) GetWindowLongPtrW((HWND) lParam, GWL_EXSTYLE);
|
||||||
|
if ((exstyle & WS_EX_TRANSPARENT) != 0) {
|
||||||
|
if (SetBkMode((HDC) wParam, TRANSPARENT) == 0)
|
||||||
|
xpanic("error setting transparent background mode to Labels", GetLastError());
|
||||||
|
*lResult = (LRESULT) hollowBrush;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ func finishNewLabel(text string, standalone bool) *label {
|
||||||
// SS_NOPREFIX avoids accelerator translation; SS_LEFTNOWORDWRAP clips text past the end
|
// SS_NOPREFIX avoids accelerator translation; SS_LEFTNOWORDWRAP clips text past the end
|
||||||
// controls are vertically aligned to the top by default (thanks Xeek in irc.freenode.net/#winapi)
|
// controls are vertically aligned to the top by default (thanks Xeek in irc.freenode.net/#winapi)
|
||||||
C.SS_NOPREFIX | C.SS_LEFTNOWORDWRAP,
|
C.SS_NOPREFIX | C.SS_LEFTNOWORDWRAP,
|
||||||
0)
|
C.WS_EX_TRANSPARENT)
|
||||||
l := &label{
|
l := &label{
|
||||||
_hwnd: hwnd,
|
_hwnd: hwnd,
|
||||||
standalone: standalone,
|
standalone: standalone,
|
||||||
|
|
Loading…
Reference in New Issue