0
SetBkMode
에 TRANSPARENT
이라는 문 제가 있습니다. 이전 텍스트는 새 텍스트를 그리기 전에 비트 맵에서 지워지지 않습니다. 이것은 그리기 코드입니다.투명도가있는 SetBkMode를 사용할 때 배경을 수정하는 방법이 업데이트되지 않았습니다.
void PaintWindow(WTL::CDCHandle dc)
{
CRect rcWindow;
HFONT hPrevFont, hFont;
DWORD dwStyle;
UINT uTextFormat;
ATLVERIFY(GetWindowRect(rcWindow));
dwStyle = GetStyle();
// Setup Font to use.
hFont = GetFont();
if (hFont != nullptr)
hPrevFont = dc.SelectFont(hFont);
else
hPrevFont = nullptr;
// Setup Text Format.
uTextFormat = 0;
if (dwStyle & SS_ENDELLIPSIS)
uTextFormat |= DT_END_ELLIPSIS;
if (dwStyle & SS_NOPREFIX)
uTextFormat |= DT_NOPREFIX;
if (dwStyle & SS_RIGHT)
uTextFormat |= DT_RIGHT;
// Draw Text.
dc.SetTextColor(m_crTextColor);
dc.SetBkMode(TRANSPARENT);
dc.DrawText(m_strText, m_strText.GetLength(), CRect(0, 0, rcWindow.Width(), rcWindow.Height()), uTextFormat);
// Clean up.
if (hPrevFont != nullptr)
dc.SelectFont(hPrevFont);
}
미리 감사드립니다.
그래서 '투명도'를'오페라 '로 변경하려고 했습니까? –
투명한 배경으로 텍스트를 그릴 필요가 있습니다. 그래서 OPAQUE는 선택 사항이 아닙니다. – UltimaWeapon