Author: Anonymous Language: cpp
Description: No description Timestamp: 2007-10-18 12:28:38 -0400
View raw paste Reply
  1. bool CWindow::PaintParentWindow(void)
  2. {
  3.         if (m_hWnd != NULL)
  4.         {
  5.                 PAINTSTRUCT PaintStruct;
  6.  
  7.                 memset(&PaintStruct, 0, sizeof(PAINTSTRUCT));
  8.  
  9.                 BeginPaint(m_hWnd, &PaintStruct);
  10.  
  11.                 if (m_bIsWindowThemed)
  12.                 {
  13.                         BITMAP Bitmap;
  14.                         HBITMAP hTitlebar = NULL;
  15.                         HPEN hPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
  16.  
  17.                         SelectObject(PaintStruct.hdc, hPen);
  18.                         Rectangle(PaintStruct.hdc, 0, 0, m_iWidth, m_iHeight);
  19.  
  20.                         GetObject(m_hTitlebar, sizeof(BITMAP), &Bitmap);
  21.                         hTitlebar = (HBITMAP) SelectObject(m_hDCTitlebar, m_hTitlebar);
  22.                         StretchBlt(PaintStruct.hdc, 1, 0, m_iWidth - 2, Bitmap.bmHeight, m_hDCTitlebar, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight, SRCCOPY);
  23.  
  24.                         SelectObject(PaintStruct.hdc, m_hFont);
  25.                         SetBkMode(PaintStruct.hdc, TRANSPARENT);
  26.                         SetTextColor(PaintStruct.hdc, RGB(148, 148, 148));
  27.  
  28.                         TextOut(PaintStruct.hdc, 25, 5, m_pszText, strlen(m_pszText));
  29.                         DrawIconEx(PaintStruct.hdc, 4, 4, m_hIcon, 16, 16, 0, NULL, DI_NORMAL);
  30.  
  31.                         DeleteObject(hPen);
  32.                 }
  33.  
  34.                 EndPaint(m_hWnd, &PaintStruct);
  35.         }
  36.  
  37.         return false;
  38. }
View raw paste Reply