void CGraphListCtrl::DrawItem( CGraphBlockViewWnd* pWnd, CRect rc, int nType, CDC* pDC ) { rc.InflateRect(1,1); DrawItemBackground(pDC, rc, GetBkColor(), nType); rc.DeflateRect(1, 1); if (m_bShowCaption) { CRect rtCaption(rc); rc.bottom -= m_nCaptionHeight; rtCaption.top = rc.bottom; CString str = pWnd->GetName(); DrawItemCaption(pDC, rtCaption, str, nType % 4 == 2); } pWnd->MoveWindow(rc); }
void CVideoPane::CreateCaption(const CRect& rect, const CString& strOcxPath) { // 设置资源路径 CString strCaptionPath(strOcxPath); strCaptionPath.Append(IMG_CAPTION_PATH); // 设置坐标 CRect rtCaption(rect); rtCaption.bottom = CAPTION_HEIGHT; // 加载资源图片 m_pImgCaption = Gdiplus::Image::FromFile(strCaptionPath + IMG_CAPTION); if (NULL == m_pImgCaption) { LOG_RUN_INFO("m_pImgCaption is null."); } else { if (Gdiplus::Ok != m_pImgCaption->GetLastStatus()) { LOG_RUN_INFO("Gdiplus::Image::FromFile failed."); m_pImgCaption = NULL; } } // 标题栏关闭按钮 CRect rtClose; rtClose.left = (rect.right - BTN_CLOSE_SPACE) - BTN_CLOSE_WIDTH; rtClose.top = (CAPTION_HEIGHT - BTN_CLOSE_HEIGHT)/2; rtClose.right = rtClose.left + BTN_CLOSE_WIDTH; rtClose.bottom = rtClose.top + BTN_CLOSE_HEIGHT; m_CloseBtn.Create(_T(""), WS_CHILD | WS_VISIBLE, rtClose, this, IDC_BTN_CLOSEVIDEO); m_CloseBtn.LoadImages(strCaptionPath + IMG_CLOSE_NORMAL, strCaptionPath + IMG_CLOSE_SELECT, strCaptionPath + IMG_CLOSE_FOCUS, strCaptionPath + IMG_CLOSE_DISABLE); m_CloseBtn.AddToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_CLOSEVIDEO))); }