comctl32: Some painting fixes for the syslink control.

This commit is contained in:
Thomas Weidenmueller 2006-01-06 13:04:14 +01:00 committed by Alexandre Julliard
parent d1b375f7e6
commit adc416b756

View File

@ -877,10 +877,10 @@ static LRESULT SYSLINK_Draw (SYSLINK_INFO *infoPtr, HDC hdc)
ExtTextOutW(hdc, bl->rc.left, bl->rc.top, ETO_OPAQUE | ETO_CLIPPED, &bl->rc, tx, bl->nChars, NULL); ExtTextOutW(hdc, bl->rc.left, bl->rc.top, ETO_OPAQUE | ETO_CLIPPED, &bl->rc, tx, bl->nChars, NULL);
if((Current->Type == slLink) && (Current->u.Link.state & LIS_FOCUSED) && infoPtr->HasFocus) if((Current->Type == slLink) && (Current->u.Link.state & LIS_FOCUSED) && infoPtr->HasFocus)
{ {
COLORREF PrevColor; COLORREF PrevTextColor;
PrevColor = SetBkColor(hdc, OldBkColor); PrevTextColor = SetTextColor(hdc, infoPtr->TextColor);
DrawFocusRect(hdc, &bl->rc); DrawFocusRect(hdc, &bl->rc);
SetBkColor(hdc, PrevColor); SetTextColor(hdc, PrevTextColor);
} }
tx += bl->nChars; tx += bl->nChars;
n -= bl->nChars + bl->nSkip; n -= bl->nChars + bl->nSkip;
@ -907,8 +907,11 @@ static LRESULT SYSLINK_Paint (SYSLINK_INFO *infoPtr, HDC hdcParam)
PAINTSTRUCT ps; PAINTSTRUCT ps;
hdc = hdcParam ? hdcParam : BeginPaint (infoPtr->Self, &ps); hdc = hdcParam ? hdcParam : BeginPaint (infoPtr->Self, &ps);
SYSLINK_Draw (infoPtr, hdc); if (hdc)
if (!hdcParam) EndPaint (infoPtr->Self, &ps); {
SYSLINK_Draw (infoPtr, hdc);
if (!hdcParam) EndPaint (infoPtr->Self, &ps);
}
return 0; return 0;
} }
@ -972,8 +975,7 @@ static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
/* clear the document */ /* clear the document */
SYSLINK_ClearDoc(infoPtr); SYSLINK_ClearDoc(infoPtr);
textlen = lstrlenW(Text); if(Text == NULL || (textlen = lstrlenW(Text)) == 0)
if(Text == NULL || textlen == 0)
{ {
return TRUE; return TRUE;
} }
@ -983,9 +985,13 @@ static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
{ {
/* Render text position and word wrapping in memory */ /* Render text position and word wrapping in memory */
HDC hdc = GetDC(infoPtr->Self); HDC hdc = GetDC(infoPtr->Self);
SYSLINK_Render(infoPtr, hdc); if (hdc != NULL)
SYSLINK_Draw(infoPtr, hdc); {
ReleaseDC(infoPtr->Self, hdc); SYSLINK_Render(infoPtr, hdc);
ReleaseDC(infoPtr->Self, hdc);
InvalidateRect(infoPtr->Self, NULL, TRUE);
}
} }
return TRUE; return TRUE;