Set clipping region to client window before owner-drawn painting.

This commit is contained in:
Gerard Patel 2000-07-16 15:39:37 +00:00 committed by Alexandre Julliard
parent 08412fb64d
commit 9788ba6e54
1 changed files with 12 additions and 10 deletions

View File

@ -484,6 +484,8 @@ static void LISTBOX_PaintItem( WND *wnd, LB_DESCR *descr, HDC hdc,
if (IS_OWNERDRAW(descr)) if (IS_OWNERDRAW(descr))
{ {
DRAWITEMSTRUCT dis; DRAWITEMSTRUCT dis;
RECT r;
HRGN hrgn;
if (!item) if (!item)
{ {
@ -493,6 +495,16 @@ static void LISTBOX_PaintItem( WND *wnd, LB_DESCR *descr, HDC hdc,
FIXME("called with an out of bounds index %d(%d) in owner draw, Not good.\n",index,descr->nb_items); FIXME("called with an out of bounds index %d(%d) in owner draw, Not good.\n",index,descr->nb_items);
return; return;
} }
/* some programs mess with the clipping region when
drawing the item, *and* restore the previous region
after they are done, so a region has better to exist
else everything ends clipped */
GetClientRect(wnd->hwndSelf, &r);
hrgn = CreateRectRgnIndirect(&r);
SelectClipRgn( hdc, hrgn);
DeleteObject( hrgn );
dis.CtlType = ODT_LISTBOX; dis.CtlType = ODT_LISTBOX;
dis.CtlID = wnd->wIDmenu; dis.CtlID = wnd->wIDmenu;
dis.hwndItem = wnd->hwndSelf; dis.hwndItem = wnd->hwndSelf;
@ -924,16 +936,6 @@ static LRESULT LISTBOX_Paint( WND *wnd, LB_DESCR *descr, HDC hdc )
rect.right += descr->horz_pos; rect.right += descr->horz_pos;
} }
if (IS_OWNERDRAW(descr))
{
RECT r;
HRGN hrgn;
GetClientRect(wnd->hwndSelf, &r);
hrgn = CreateRectRgnIndirect(&r);
SelectClipRgn( hdc, hrgn);
DeleteObject( hrgn );
}
if (descr->font) oldFont = SelectObject( hdc, descr->font ); if (descr->font) oldFont = SelectObject( hdc, descr->font );
hbrush = SendMessageA( descr->owner, WM_CTLCOLORLISTBOX, hbrush = SendMessageA( descr->owner, WM_CTLCOLORLISTBOX,
hdc, (LPARAM)wnd->hwndSelf ); hdc, (LPARAM)wnd->hwndSelf );