0

に問題がSetBkModeありTRANSPARENTます。以前のテキストは、新しいテキストを描画する前にビットマップから消去されません。描画用のコードです。

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);
}

よろしくお願いします。

4

1 に答える 1