1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(inst->hwnd, &ps);
if (inst->Paint==NULL)
{
RECT f;
GetClientRect(hwnd,&f);
HBRUSH s=CreateSolidBrush(inst->clrBackColor);
SelectObject(hdc,(HBRUSH)s);
if (inst->clrBackColor==-1)
BitBlt(hdc,0,0,f.right-f.left,f.bottom-f.top,GetDC(GetParent(inst->hwnd)),inst->intLeft,inst->intTop,SRCCOPY);
else
FillRect(hdc,&f,s);
SetBkMode(hdc,TRANSPARENT);
char *text=(char*)inst->strCaption.c_str();
SetTextColor(hdc,inst->clrTextColor );
DrawTextEx(hdc,text,-1,&f,DT_CENTER,NULL);
DeleteObject(s);
}
else
inst->Paint(inst->hwnd,hdc);
EndPaint(inst->hwnd, &ps);
}
break;
| |