A
andy263
Unregistered / Unconfirmed
GUEST, unregistred user!
部分代码如下:
bounds: TRect;
memDC: HDC;
wndWidth, wndHeight: integer;
membmp, oldbmp: HBITMAP;
begin
GetClientRect(panel1.handel, bounds);
wndWidth := bounds.right - bounds.left;
wndHeight := bounds.bottom - bounds.top;
// 创建与目标窗口DC兼容的内存DC
memDC := CreateCompatibleDC(mClientDC);
// 创建与目标窗口DC兼容的位图
membmp := CreateCompatibleBitmap(mClientDC, wndWidth, wndHeight);
// 将位图选入内存DC中
oldbmp := SelectObject(memDC, membmp);
FillRect(memDC, bounds, GetStockObject(LTGRAY_BRUSH));
最后关键一句。LTGRAY_BRUSH是浅灰色的底色 我用NULL_BRUSH则变成了黑色 而不是我想象的透明。 如果我想达到透明效果应该怎么做?
bounds: TRect;
memDC: HDC;
wndWidth, wndHeight: integer;
membmp, oldbmp: HBITMAP;
begin
GetClientRect(panel1.handel, bounds);
wndWidth := bounds.right - bounds.left;
wndHeight := bounds.bottom - bounds.top;
// 创建与目标窗口DC兼容的内存DC
memDC := CreateCompatibleDC(mClientDC);
// 创建与目标窗口DC兼容的位图
membmp := CreateCompatibleBitmap(mClientDC, wndWidth, wndHeight);
// 将位图选入内存DC中
oldbmp := SelectObject(memDC, membmp);
FillRect(memDC, bounds, GetStockObject(LTGRAY_BRUSH));
最后关键一句。LTGRAY_BRUSH是浅灰色的底色 我用NULL_BRUSH则变成了黑色 而不是我想象的透明。 如果我想达到透明效果应该怎么做?