void COutlook2Ctrl::AnimateToFolder(int f) { m_iSelectedFolder = f; pLastHilink = NULL; m_csCaption = GetFolder(f)->csName; if (m_iSize > 4) { CRect rc; GetClientRect(rc); CDC dc; CClientDC cdc(this); dc.CreateCompatibleDC(&cdc); CBitmap bmp; bmp.CreateCompatibleBitmap(&cdc, rc.Width(), rc.Height()); CBitmap * ob = (CBitmap *) dc.SelectObject(&bmp); DrawCaption(&dc, rc); CRect rcBdr(rc); rc.InflateRect(-1,-1); DrawButtons(&dc, rc); int iBottomInner = rc.bottom; dc.Draw3dRect(rcBdr, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); rcInnerRect = rc; dc.FillSolidRect(rc, m_crBackground); if (m_iSelectedFolder >= 0 && m_iSelectedFolder < m_Folders.GetSize()) { COL2Folder * o = (COL2Folder *) m_Folders.GetAt(m_iSelectedFolder); DrawItems(&dc, o, rc); } for (int t = iBottomInner - 10; t > 0; t -= (iBottomInner/8)) { cdc.BitBlt(0,t,rc.Width(), iBottomInner - t, &dc, 0,0, SRCCOPY); Sleep(30); } dc.SelectObject(ob); } Invalidate(); }
void CColorButtonCtrl::DrawButtonDown(CDC* pDC, CRect& rc) { // draw button down DrawBevelInset(pDC, rc); // erase caption DrawCaption(pDC, rc, m_BackColor); // move caption and redraw CRect rcTemp; CopyRect(rcTemp, rc); rcTemp.OffsetRect(1,1); DrawCaption(pDC, rcTemp, m_ForeColor); }
void COXRollup::OnActivate(UINT nState, CWnd* pOther, BOOL bMinimized) { CDialog::OnActivate(nState,pOther,bMinimized); // now draw the caption bars if((WA_ACTIVE == nState) || (WA_CLICKACTIVE == nState)) { DrawCaption(COLOR_ACTIVECAPTION); } if(WA_INACTIVE==nState) { DrawCaption(COLOR_INACTIVECAPTION); } }
void CColorButtonCtrl::DrawControl(CDC& dc, CRect& rc) { // paint the button rect CBrush br(m_BackColor), *pbrOld; CRect rcClip; dc.GetClipBox(&rcClip); pbrOld = dc.SelectObject(&br); dc.PatBlt(rcClip.left, rcClip.top, (rcClip.right - rcClip.left), (rcClip.bottom - rcClip.top), PATCOPY); dc.SelectObject(pbrOld); // draw bevel DrawBevelRaised(&dc, rc); // draw caption DrawCaption(&dc, rc, GetEnabled()? m_ForeColor : ::GetSysColor(COLOR_GRAYTEXT)); // draw the frame if (this == GetFocus() ) { CBrush br(::GetSysColor(COLOR_3DDKSHADOW)); FrameButton(br); } }
void CMyPropertySheet::OnPaint() { CPaintDC dc(this); // device context for painting CRect rectList,rectPage; m_wndList.GetWindowRect(&rectList); GetPage(0)->GetWindowRect(&rectPage); ScreenToClient(&rectPage); ScreenToClient(&rectList); rectList.left = rectList.left -1; rectList.right = rectList.right + 1; rectList.top = rectList.top - 1; rectList.bottom = rectList.bottom + 1; rectPage.left -= 1; rectPage.right += 1; rectPage.top -= 1; rectPage.bottom += 1; CBrush brush(RGB(141,141,141)); dc.FrameRect(&rectList,&brush); dc.FrameRect(&rectPage, &brush); DrawCaption(&dc, m_clrCaption); }
VOID CapTest(HWND hWnd, HDC hDc, LPRECT pR, WCHAR *Text, DWORD Flags, WCHAR *AddonStr, DWORD Addon) { WCHAR Buf[512]; lstrcpy(Buf, AddonStr); if(lstrlen(Buf))lstrcat(Buf, L" | "); lstrcat(Buf, Text); DrawText( hDc, Buf, lstrlen(Buf), pR, DT_LEFT ); pR->top+=20; pR->bottom+=20; if(!DrawCaption(hWnd, hDc, pR, Flags | Addon)) { printf("PAINT: DrawCaption failed: %d\n", (int)GetLastError()); } pR->top+=30; pR->bottom+=30; }
void COscillogram::DrawPrint(CDC *dc, CRect *dRect) { int oldmode = dc->SetMapMode(MM_LOMETRIC); //获得网格矩形 m_GridRect.top = dRect->top - CS_MARGIN; m_GridRect.left = dRect->left + CS_MARGIN; m_GridRect.bottom = dRect->bottom + CS_MARGIN; m_GridRect.right = dRect->right - CS_MARGIN; //计算标题矩形 m_CaptionRect.top = dRect->top; m_CaptionRect.left = dRect->left; m_CaptionRect.bottom = m_GridRect.top ; m_CaptionRect.right = dRect->right; //计算步长宽度 m_xSpan = (float)m_GridRect.Width() / (m_xCount-1); m_ySpan = (float)m_GridRect.Height() / (m_yCount-1); //绘画工作 DrawCaption(dc); DrawGrid(dc); for(int i=0;i<GetCurveCount();i++) DrawCurve(dc,GetCurve(i)); dc->SetMapMode(oldmode); }
void COutlook2Ctrl::OnPaint() { ClearRects(); CPaintDC pdc(this); CRect rc; GetClientRect(rc); if (m_iSize <= 4) { pdc.FillSolidRect(rc, GetSysColor(COLOR_3DFACE)); return; } COMemDC dc(&pdc); DrawCaption(&dc, rc); CRect rcBdr(rc); rc.InflateRect(-1,-1); DrawButtons(&dc, rc); dc.Draw3dRect(rcBdr, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT)); rcInnerRect = rc; dc.FillSolidRect(rc, m_crBackground); if (m_iSelectedFolder >= 0 && m_iSelectedFolder < m_Folders.GetSize()) { COL2Folder * o = (COL2Folder *) m_Folders.GetAt(m_iSelectedFolder); DrawItems(&dc, o, rc); } }
void SlideShowSaver::Draw(BView *view, int32 frame) { fLock.Lock(); view->SetLowColor(0, 0, 0); view->SetHighColor(192, 192, 192); view->SetViewColor(192, 192, 192); bool bResult = false; if (fNewDirectory == true) { // Already have a bitmap on the first frame bResult = true; } else { bResult = ShowNextImage(true, false); // try rewinding to beginning if (bResult == false) bResult = ShowNextImage(true, true); } fNewDirectory = false; if (bResult == true && fBitmap != NULL) { BRect destRect(0, 0, fBitmap->Bounds().Width(), fBitmap->Bounds().Height()), vwBounds = view->Bounds(); if (destRect.Width() < vwBounds.Width()) { destRect.OffsetBy((vwBounds.Width() - destRect.Width()) / 2, 0); } if (destRect.Height() < vwBounds.Height()) { destRect.OffsetBy(0, (vwBounds.Height() - destRect.Height()) / 2); } BRect border = destRect, bounds = view->Bounds(); // top view->FillRect(BRect(0, 0, bounds.right, border.top-1), B_SOLID_LOW); // left view->FillRect(BRect(0, border.top, border.left-1, border.bottom), B_SOLID_LOW); // right view->FillRect(BRect(border.right+1, border.top, bounds.right, border.bottom), B_SOLID_LOW); // bottom view->FillRect(BRect(0, border.bottom+1, bounds.right, bounds.bottom), B_SOLID_LOW); if (fShowBorder == true) { BRect strokeRect = destRect; strokeRect.InsetBy(-1, -1); view->StrokeRect(strokeRect); } view->DrawBitmap(fBitmap, fBitmap->Bounds(), destRect); if (fShowCaption == true) DrawCaption(view); } fLock.Unlock(); }
virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { case WID_N_CAPTION: DrawCaption(r, COLOUR_LIGHT_BLUE, this->owner, STR_NEWS_MESSAGE_CAPTION); break; case WID_N_PANEL: this->DrawNewsBorder(r); break; case WID_N_MESSAGE: CopyInDParam(0, this->ni->params, lengthof(this->ni->params)); DrawStringMultiLine(r.left, r.right, r.top, r.bottom, this->ni->string_id, TC_FROMSTRING, SA_CENTER); break; case WID_N_MGR_FACE: { const CompanyNewsInformation *cni = (const CompanyNewsInformation*)this->ni->free_data; DrawCompanyManagerFace(cni->face, cni->colour, r.left, r.top); GfxFillRect(r.left, r.top, r.right, r.bottom, PALETTE_NEWSPAPER, FILLRECT_RECOLOUR); break; } case WID_N_MGR_NAME: { const CompanyNewsInformation *cni = (const CompanyNewsInformation*)this->ni->free_data; SetDParamStr(0, cni->president_name); DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_JUST_RAW_STRING, TC_FROMSTRING, SA_CENTER); break; } case WID_N_COMPANY_MSG: DrawStringMultiLine(r.left, r.right, r.top, r.bottom, this->GetCompanyMessageString(), TC_FROMSTRING, SA_CENTER); break; case WID_N_VEH_BKGND: GfxFillRect(r.left, r.top, r.right, r.bottom, PC_GREY); break; case WID_N_VEH_NAME: case WID_N_VEH_TITLE: DrawStringMultiLine(r.left, r.right, r.top, r.bottom, this->GetNewVehicleMessageString(widget), TC_FROMSTRING, SA_CENTER); break; case WID_N_VEH_SPR: { assert(this->ni->reftype1 == NR_ENGINE); EngineID engine = this->ni->ref1; DrawVehicleEngine(r.left, r.right, (r.left + r.right) / 2, (r.top + r.bottom) / 2, engine, GetEnginePalette(engine, _local_company), EIT_PREVIEW); GfxFillRect(r.left, r.top, r.right, r.bottom, PALETTE_NEWSPAPER, FILLRECT_RECOLOUR); break; } case WID_N_VEH_INFO: { assert(this->ni->reftype1 == NR_ENGINE); EngineID engine = this->ni->ref1; DrawStringMultiLine(r.left, r.right, r.top, r.bottom, GetEngineInfoString(engine), TC_FROMSTRING, SA_CENTER); break; } } }
void COscillogram::DrawOscillogram(CDC *dc) { int oldmode = dc->SetMapMode(MM_LOMETRIC); SetOscillogramRect(dc); DrawCaption(dc); DrawGrid(dc); for(int i=0;i<GetCurveCount();i++) DrawCurve(dc,GetCurve(i)); dc->SetMapMode(oldmode); }
void CColorButtonCtrl::DrawButtonUp(CDC* pDC, CRect& rc) { // draw button up DrawBevelRaised(pDC, rc); // erase caption CRect rcTemp; CopyRect(rcTemp, rc); rcTemp.OffsetRect(1,1); DrawCaption(pDC, rcTemp, m_BackColor); // redraw caption rcTemp.OffsetRect(-1,-1); DrawCaption(pDC, rcTemp, m_ForeColor); // draw the frame if (this == GetFocus() ) { CBrush br(::GetSysColor(COLOR_3DDKSHADOW)); FrameButton(br); } }
//绘画函数 void CShortMessage::OnPaint() { CPaintDC dc(this); //绘画标题 DrawCaption(&dc); CRect ClientRect; GetClientRect(&ClientRect); int nXExcursion=GetXExcursionPos(); int nYExcursion=GetYExcursionPos(); //绘画背景 COLORREF Color = RGB(170,213,244); dc.FillSolidRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,4,Color); dc.FillSolidRect(nXExcursion,ClientRect.Height()-8,ClientRect.Width()-2*nXExcursion,7,Color); dc.FillSolidRect(nXExcursion,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color); dc.FillSolidRect(ClientRect.Width()-nXExcursion-12,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color); CRect mRect(nXExcursion,190,ClientRect.Width()-2*nXExcursion,ClientRect.Height()); CBrush Brush(Color); dc.FillRect(mRect,&Brush); //创建笔画 CPen BorderPen(PS_SOLID,1,RGB(20,20,20)); CPen * pOldPen=dc.SelectObject(&BorderPen); dc.SelectObject(m_SkinAttribute.m_brBackGround); //绘画内框 CRect rcDrawRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,200); rcDrawRect.DeflateRect(6,4,6,4); dc.RoundRect(&rcDrawRect,CPoint(8,8)); //清理资源 dc.SelectObject(pOldPen); BorderPen.DeleteObject(); //创建笔画 CPen BorderPen1(PS_SOLID,1,m_SkinAttribute.m_crInsideBorder); pOldPen=dc.SelectObject(&BorderPen1); //绘画内框 rcDrawRect.DeflateRect(1,1,1,1); dc.RoundRect(&rcDrawRect,CPoint(8,8)); CRect rcDrawRect1(nXExcursion+9,203,ClientRect.Width()-2*nXExcursion-8,ClientRect.Height()-37); dc.RoundRect(&rcDrawRect1,CPoint(4,4)); //清理资源 dc.SelectObject(pOldPen); BorderPen1.DeleteObject(); return; }
//重画消息 void CSkinDialogEx::OnPaint() { CPaintDC dc(this); //绘画标题 DrawCaption(&dc); //绘画背景 DrawBackGround(&dc); //绘画边框 DrawBorder(&dc); return; }
///////////////////////////////////////////////////////////////////////////// // COFSNcDlg message handlers void COFSNcDlg::OnNcPaint( ) { //// Творим Что хотим CRect rWin,rClient; GetWindowRect(&rWin); GetClientRect(&rClient); CRect m_CaptionRect; m_CaptionRect.left = BoundaryX; m_CaptionRect.top = BoundaryY; m_CaptionRect.right = rWin.Width()- BoundaryX; m_CaptionRect.bottom = CaptionH + BoundaryY; ScreenToClient(&rWin); CRgn rgnWin,rgnClient,rgnUp,rgnCap; rgnUp.CreateRectRgn(0,0,0,0); rgnWin.CreateRectRgnIndirect(&rWin); rgnClient.CreateRectRgnIndirect(&rClient); rgnUp.CombineRgn(&rgnWin,&rgnClient,RGN_DIFF); rgnUp.OffsetRgn(CPoint(-rWin.left,-rWin.top)); rgnCap.CreateRectRgnIndirect(m_CaptionRect); CWindowDC dc(this); dc.SelectClipRgn(&rgnUp,RGN_COPY); CBrush br; if(pBoundaryBMP) br.CreatePatternBrush(pBoundaryBMP); else br.CreateSolidBrush(m_BoundaryColor); rgnUp.CombineRgn(&rgnUp,&rgnCap,RGN_DIFF); dc.FillRgn(&rgnUp,&br); DrawCaption(dc,m_CaptionRect); }
void CDBFrame::OnNcPaint() { if (IsIconic()) { return; } CDC *pDC; pDC = GetWindowDC(); if (pDC == NULL) //获取DC失败,则不画 return; CRect rect; GetWindowRect(&rect); CMemDC memDC(pDC, rect.Width(), m_imageCaption.Height() + m_rcSysBorder.top); DrawCaption(&memDC); DrawSysButtons(&memDC); pDC->BitBlt(0, 0, rect.Width(), m_imageCaption.Height() + m_rcSysBorder.top, &memDC, 0, 0, SRCCOPY); DrawBorder(pDC); ReleaseDC(pDC); }
//绘画函数 void CFlowerSetting::OnPaint() { CPaintDC dc(this); //绘画标题 DrawCaption(&dc); CRect ClientRect; GetClientRect(&ClientRect); int nXExcursion=GetXExcursionPos(); int nYExcursion=GetYExcursionPos(); //绘画背景 COLORREF Color = RGB(161,212,226); dc.FillSolidRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,4,Color); dc.FillSolidRect(nXExcursion,ClientRect.Height()-8,ClientRect.Width()-2*nXExcursion,7,Color); dc.FillSolidRect(nXExcursion,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color); dc.FillSolidRect(ClientRect.Width()-nXExcursion-12,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color); //绘画边框 DrawBorder(&dc); }
void QnSkinDialog::OnThemeNcPaint() { CDC* pDc = GetWindowDC(); CDC memDc; memDc.CreateCompatibleDC(pDc); CBitmap* bitmap = m_pThemeDialog->m_pBmpActiveBorder; if (bitmap == 0) return; BITMAP bm; bitmap->GetBitmap(&bm); CRect rcBmp; rcBmp.left = 0; rcBmp.right = bm.bmWidth; rcBmp.top = 0; rcBmp.bottom = bm.bmHeight; CRect rcWin; GetWindowRect(&rcWin); rcWin -= CPoint(rcWin.left, rcWin.top); CBitmap bmp; bmp.CreateCompatibleBitmap(pDc, rcWin.Width(),m_pThemeDialog->m_nToTop); CBitmap* pOldBmp = memDc.SelectObject(&bmp); DrawBorder(pDc, rcWin, rcBmp, TRUE); rcWin.bottom = rcWin.top + m_pThemeDialog->m_nToTop; DrawCaption(&memDc, rcWin, rcBmp, TRUE); pDc->BitBlt(0, 0, rcWin.Width(), rcWin.Height(), &memDc, 0, 0, SRCCOPY); memDc.SelectObject(pOldBmp); memDc.DeleteDC(); ReleaseDC(pDc); }
void CBCGPPlannerPrintMonth::OnDrawHeader (CDC* pDC, const CRect& rectHeader) { ASSERT_VALID (pDC); const int dxColumn = m_ViewRects [0].Width (); CRect rectDayCaption (rectHeader); DrawHeader (pDC, rectDayCaption, dxColumn); rectDayCaption.right = rectDayCaption.left + dxColumn; COleDateTime day ( GetFirstWeekDay2 (m_Date, CBCGPPlannerManagerCtrl::GetFirstDayOfWeek () + 1) ); const int nEnd = m_bCompressWeekend ? 6 : 7; CStringArray sa; sa.SetSize (nEnd); int iColumn = 0; for (iColumn = 0; iColumn < nEnd; iColumn++) { CString strDate; if (IsCompressWeekend () && day.GetDayOfWeek () == 7) { for (int i = 0; i < 2; i++) { CString strTemp; strTemp.GetBuffer (_MAX_PATH); SYSTEMTIME st; day.GetAsSystemTime (st); ::GetDateFormat (LOCALE_USER_DEFAULT, 0, &st, _T("ddd"), (LPTSTR)(LPCTSTR)strTemp, _MAX_PATH); strTemp.ReleaseBuffer (); strDate += strTemp; if (i == 0) { strDate += _T("/"); } day += COleDateTimeSpan (1, 0, 0, 0); } } else { strDate.GetBuffer (_MAX_PATH); SYSTEMTIME st; day.GetAsSystemTime (st); ::GetDateFormat (LOCALE_USER_DEFAULT, 0, &st, m_strCaptionFormat, (LPTSTR)(LPCTSTR)strDate, _MAX_PATH); strDate.ReleaseBuffer (); day += COleDateTimeSpan (1, 0, 0, 0); } sa.SetAt (iColumn, strDate); } for (iColumn = 0; iColumn < nEnd; iColumn++) { DrawCaption (pDC, rectDayCaption, sa[iColumn], TRUE, TRUE, m_brGray); rectDayCaption.OffsetRect (dxColumn + m_OnePoint.cx, 0); } }
void CBCGPPlannerPrintMonth::OnDrawClient (CDC* pDC) { ASSERT_VALID (pDC); CRect rectFill (m_rectApps); int nMonth = m_Date.GetMonth (); const int nRows = GetViewDuration () / 7; COleDateTime day (GetDateStart ()); int nIndex = 0; int iRow = 0; { CPen* pOldPen = pDC->SelectObject (&m_penBlack); const int nEnd = 7; int nCol = 0; int iColumn = 1; for (iColumn = 1; iColumn < 7; iColumn++) { if (m_ViewRects [iColumn - 1].right == m_ViewRects [iColumn].right) { nCol = iColumn - 1; break; } } for (iColumn = 1; iColumn < nEnd; iColumn++) { pDC->MoveTo (m_ViewRects [iColumn].left - m_OnePoint.cx, m_rectApps.top); pDC->LineTo (m_ViewRects [iColumn].left - m_OnePoint.cx, m_rectApps.bottom); } for (iRow = 0; iRow < nRows; iRow++) { int nIndex = iRow * 7 + 6; pDC->MoveTo (m_rectApps.left , m_ViewRects [nIndex].bottom); pDC->LineTo (m_rectApps.right, m_ViewRects [nIndex].bottom); if (m_bCompressWeekend) { nIndex -= (6 - nCol); pDC->MoveTo (m_ViewRects [nIndex].left, m_ViewRects [nIndex].bottom); pDC->LineTo (m_ViewRects [nIndex].right, m_ViewRects [nIndex].bottom); } } pDC->SelectObject (pOldPen); } DWORD dwFlags = GetDrawFlags (); BOOL bBold = (dwFlags & BCGP_PLANNER_DRAW_VIEW_CAPTION_DAY_BOLD) == BCGP_PLANNER_DRAW_VIEW_CAPTION_DAY_BOLD; BOOL bCompact = (dwFlags & BCGP_PLANNER_DRAW_VIEW_CAPTION_DAY_COMPACT) == BCGP_PLANNER_DRAW_VIEW_CAPTION_DAY_COMPACT; CFont* pOldFont = NULL; if (bBold) { pOldFont = pDC->SelectObject (&m_FontBold); } const BOOL bDateBeforeMonth = CBCGPPlannerView::IsDateBeforeMonth (); for (iRow = 0; iRow < nRows; iRow++) { for (int iDay = 0; iDay < 7; iDay++) { BOOL bAnotherMonth = nMonth != day.GetMonth (); int nDay = iRow * 7 + iDay; CRect rectDayCaption (m_ViewRects [nDay]); if (m_nRowHeight <= rectDayCaption.Height () + 2 * m_OnePoint.cy) { rectDayCaption.bottom = rectDayCaption.top + m_nRowHeight + m_OnePoint.cy; CString strFormat (_T("d")); CString strDate; BOOL bNewYear = FALSE; if (!bCompact) { if ((iRow == 0 && iDay == 0) || day.GetDay () == 1) { if (bDateBeforeMonth) { strFormat = _T("d MMMM"); } else { strFormat = _T("MMMM d"); } if (day.GetDay () == 1 && day.GetMonth () == 1) { bNewYear = TRUE; strFormat += _T(" yyyy"); } } if (!strFormat.IsEmpty ()) { strDate.GetBuffer (_MAX_PATH); SYSTEMTIME st; day.GetAsSystemTime (st); ::GetDateFormat (LOCALE_USER_DEFAULT, 0, &st, strFormat, (LPTSTR)(LPCTSTR)strDate, _MAX_PATH); strDate.ReleaseBuffer (); CSize szSize (pDC->GetTextExtent (strDate)); if (rectDayCaption.Width () - 4 < szSize.cx) { if (bDateBeforeMonth) { strFormat = _T("d MMM"); } else { strFormat = _T("MMM d"); } if (bNewYear) { strFormat += _T(" yy"); } strDate.GetBuffer (_MAX_PATH); ::GetDateFormat (LOCALE_USER_DEFAULT, 0, &st, strFormat, (LPTSTR)(LPCTSTR)strDate, _MAX_PATH); strDate.ReleaseBuffer (); } } } else { if ((iRow == 0 && iDay == 0) || day.GetDay () == 1) { if (bDateBeforeMonth) { strFormat = _T("d MMM"); } else { strFormat = _T("MMM d"); } if (day.GetDay () == 1 && day.GetMonth () == 1) { bNewYear = TRUE; strFormat += _T(" yy"); } } if (!strFormat.IsEmpty ()) { strDate.GetBuffer (_MAX_PATH); SYSTEMTIME st; day.GetAsSystemTime (st); ::GetDateFormat (LOCALE_USER_DEFAULT, 0, &st, strFormat, (LPTSTR)(LPCTSTR)strDate, _MAX_PATH); strDate.ReleaseBuffer (); CSize szSize (pDC->GetTextExtent (strDate)); if (rectDayCaption.Width () - 4 < szSize.cx) { strFormat = _T("d"); BOOL bNeedFormat = TRUE; if (bNewYear) { if (bDateBeforeMonth) { strFormat += _T(" MMM"); } else { strFormat = _T("MMM ") + strFormat; } bNeedFormat = FALSE; strDate.GetBuffer (_MAX_PATH); ::GetDateFormat (LOCALE_USER_DEFAULT, 0, &st, strFormat, (LPTSTR)(LPCTSTR)strDate, _MAX_PATH); strDate.ReleaseBuffer (); szSize = pDC->GetTextExtent (strDate); if (rectDayCaption.Width () - 4 < szSize.cx) { strFormat = _T("d"); bNeedFormat = TRUE; } } if (bNeedFormat) { strDate.GetBuffer (_MAX_PATH); ::GetDateFormat (LOCALE_USER_DEFAULT, 0, &st, strFormat, (LPTSTR)(LPCTSTR)strDate, _MAX_PATH); strDate.ReleaseBuffer (); } } } } DrawCaption (pDC, rectDayCaption, strDate, FALSE, TRUE, bAnotherMonth ? m_brDarkGray : m_brGray); } day += COleDateTimeSpan (1, 0, 0, 0); nIndex++; } } if (bBold && pOldFont != NULL) { pDC->SelectObject (pOldFont); } }
void CPropPageFrame::Draw(CDC *pDc) { if (GetShowCaption()) DrawCaption(pDc, CalcCaptionArea(), m_strCaption, m_hCaptionIcon); DrawMsg(pDc, CalcMsgArea(), m_strMsg, m_dwMsgFormat); }
FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return FALSE; int32_t iActive = 0; if (pParams->m_dwStates & FWL_PARTSTATE_FRM_Inactive) { iActive = 1; } FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; switch (pParams->m_dwStates & 0x03) { case FWL_PARTSTATE_FRM_Hover: { eState = FWLTHEME_STATE_Hover; break; } case FWL_PARTSTATE_FRM_Pressed: { eState = FWLTHEME_STATE_Pressed; break; } case FWL_PARTSTATE_FRM_Disabled: { eState = FWLTHEME_STATE_Disabale; break; } default: {} } switch (pParams->m_iPart) { case FWL_PART_FRM_Border: { DrawFormBorder(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } case FWL_PART_FRM_Edge: { DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), &pParams->m_rtPart, &pParams->m_matrix); break; } case FWL_PART_FRM_Background: { FillBackground(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } case FWL_PART_FRM_Caption: { DrawCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } case FWL_PART_FRM_NarrowCaption: { DrawNarrowCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } case FWL_PART_FRM_CloseBox: { DrawCloseBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } case FWL_PART_FRM_MinimizeBox: { DrawMinimizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } case FWL_PART_FRM_MaximizeBox: { DrawMaximizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, pParams->m_dwData, &pParams->m_matrix, iActive); break; } case FWL_PART_FRM_Icon: { DrawIconImage(pParams->m_pGraphics, pParams->m_pImage, &pParams->m_rtPart, eState, &pParams->m_matrix, iActive); break; } default: {} } return TRUE; }
//绘画函数 void CShortMessage::OnPaint() { CPaintDC dc(this); //绘画标题 DrawCaption(&dc); CRect ClientRect; GetClientRect(&ClientRect); int nXExcursion=GetXExcursionPos(); int nYExcursion=GetYExcursionPos(); ///////////////////////////////////////////////////////////////////////////// CRect rcClient1; GetWindowRect(&rcClient1); int nWidth1=rcClient1.Width(); int nHeight1=rcClient1.Height(); //调整判断 if ((nWidth1!=0)&&(nHeight1!=0)) { //框架位置 CRect rcFrame; rcFrame.SetRect(0,0,nWidth1,nHeight1); //窗口区域 CRgn RegionWindow; RegionWindow.CreateRoundRectRgn(rcFrame.left,rcFrame.top,rcFrame.right+1,rcFrame.bottom+1,5,5); //设置区域 SetWindowRgn(RegionWindow,TRUE); } /////////////////////////////////////////////////////////////////////////// //绘画背景 COLORREF Color = RGB(170,213,244); dc.FillSolidRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,4,Color); dc.FillSolidRect(nXExcursion,ClientRect.Height()-8,ClientRect.Width()-2*nXExcursion,7,Color); dc.FillSolidRect(nXExcursion,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color); dc.FillSolidRect(ClientRect.Width()-nXExcursion-12,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color); CRect mRect(nXExcursion,190,ClientRect.Width()-2*nXExcursion,ClientRect.Height()); CBrush Brush(Color); dc.FillRect(mRect,&Brush); //创建笔画 CPen BorderPen(PS_SOLID,1,RGB(20,20,20)); CPen * pOldPen=dc.SelectObject(&BorderPen); dc.SelectObject(m_SkinAttribute.m_brBackGround); //绘画内框 CRect rcDrawRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,200); rcDrawRect.DeflateRect(6,4,6,4); dc.RoundRect(&rcDrawRect,CPoint(8,8)); //清理资源 dc.SelectObject(pOldPen); BorderPen.DeleteObject(); //创建笔画 CPen BorderPen1(PS_SOLID,1,m_SkinAttribute.m_crInsideBorder); pOldPen=dc.SelectObject(&BorderPen1); //绘画内框 rcDrawRect.DeflateRect(1,1,1,1); dc.RoundRect(&rcDrawRect,CPoint(8,8)); CRect rcDrawRect1(nXExcursion+9,203,ClientRect.Width()-2*nXExcursion-8,ClientRect.Height()-37); dc.RoundRect(&rcDrawRect1,CPoint(4,4)); //清理资源 dc.SelectObject(pOldPen); BorderPen1.DeleteObject(); return; }
void ByjDrawRightRect::CalcSonFiguer(CDC* pDC,CRect &rt) { m_rectDrawLine = rt; { m_dataFormular .numLine = 0; CFormularContent* pIndex; pIndex=(CFormularContent*)pDoc->LookUpArray (pDoc->m_formuar_index,m_nameIndex); if(pIndex!=NULL) if(!pIndex->IsValid()) return; if(pIndex==NULL || pView->m_nCountKline<=0) { return; } m_nValidIndicator = CTaiScreenParent::IsPeriodValid(pView->m_nKlineKind2 ,pIndex); CString s ; CString str = " "; CFormularCompute* m_formuCompute = NULL; INPUT_PARAM input; input.pmax =pView->m_nCountKline-1; input.pp = pView->m_pkline; input.symbol = pView->m_sharesSymbol ; input.nKindKline = pView->m_nKlineKind2 ; input.pBuySellList =&( pView->m_hs) ; input.pIndex = pIndex; input.bAddBuySell = false; input.m_stkKind = pView->m_stkKind; float fMax, fMin; fMax = pView->m_pkline[0].high ; fMin = pView->m_pkline[0].low ; for(int j=1; j<pView->m_nCountKline; j++) { if(pView->m_pkline[j].high>fMax) fMax = pView->m_pkline[j].high; if(pView->m_pkline[j].low<fMin) fMin = pView->m_pkline[j].low; } ARRAY_Right_Box::SetTime (CTime(pView->m_pkline [pView->pKlineDrawing ->m_footCurrent].day )) ; TRACE("pView->pKlineDrawing ->m_footCurrent: %d ; \n",pView->pKlineDrawing ->m_footCurrent); ARRAY_Right_Box::GetRuler(fMax, fMin); CTaiKlineShowKline *pDoK = pView->pKlineDrawing ; pDoK->m_nSon=0; pDoK->SetRectCurrent(0); if(ComputeFormu2(m_formuCompute,input)==0) { int rtnLine=0; m_dataFormular .numLine =m_formuCompute->GetRlineNum (); if(m_dataFormular .numLine>18) m_dataFormular .numLine = 18; for(int i=0 ; i<m_dataFormular .numLine ; i++) { CString namePer; int nIn = i ; rtnLine = m_formuCompute->GetLine (nIn,m_dataFormular .line [i].m_arrBE,namePer); if(rtnLine==1) m_dataFormular .line [i].m_arrBE.b = -1; m_dataFormular .line [i].type = m_formuCompute->m_RlineType[i] ; if(namePer.GetLength()>18) m_lineName [i]="δ֪"; else m_lineName [i]=namePer; GetMaxMin(i,i==0); } for(int i=0 ; i<m_dataFormular .numLine ; i++) { DrawSonFiguer( pDC,i); } DrawCaption(pDC, pIndex); } else ; delete m_formuCompute; ARRAY_Right_Box::Reset (); } }
//绘画函数 void CPropertyItem::OnPaint() { CPaintDC dc(this); //绘画标题 DrawCaption(&dc); //获取位置 CRect ClientRect; GetClientRect(&ClientRect); int nXExcursion=GetXExcursionPos(); int nYExcursion=GetYExcursionPos(); //绘画背景 COLORREF Color = /*RGB(0,51,102)*/RGB(115,181,239); dc.FillSolidRect(nXExcursion,nYExcursion,ClientRect.Width()-2*nXExcursion,4,Color); dc.FillSolidRect(nXExcursion,ClientRect.Height()-8,ClientRect.Width()-2*nXExcursion,7,Color); dc.FillSolidRect(nXExcursion,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color); dc.FillSolidRect(ClientRect.Width()-nXExcursion-12,nYExcursion+4,12,ClientRect.Height()-nYExcursion-9,Color); //绘画边框 DrawBorder(&dc); //道具图片 CBitmap Bitmap; //加载图片 AfxSetResourceHandle(CPropertyBar::m_pPropertyBar->m_ReshInstance); if ( Bitmap.LoadBitmap(CPropertyBar::m_pPropertyBar->m_PropertyViewImage.uPropertyFormer[m_nPropertyID]) ) { //创建资源 CDC dcMem; dcMem.CreateCompatibleDC(&dc); CBitmap *pOldBitmap = dcMem.SelectObject(&Bitmap); //绘画图片 BITMAP bm; Bitmap.GetBitmap(&bm); dc.TransparentBlt(10, 28+5, bm.bmWidth, bm.bmHeight, &dcMem, 0, 0, bm.bmWidth, bm.bmHeight,RGB(255,255,255)); //是否资源 dcMem.SelectObject(pOldBitmap); Bitmap.DeleteObject(); dcMem.DeleteDC(); } AfxSetResourceHandle(GetModuleHandle(NULL)); //获取位置 CRect rcStaticName, rcStaticDes; GetDlgItem(IDC_PROPERTY_NAME)->GetWindowRect(rcStaticName); GetDlgItem(IDC_PROPERTY_DESCRIBE)->GetWindowRect(rcStaticDes); ScreenToClient(&rcStaticName); ScreenToClient(&rcStaticDes); //设置内容 CRect rcPropertyName(rcStaticName.right+3, rcStaticName.top, rcStaticName.right+200, rcStaticName.bottom+100); CRect rcPropertyDes(rcStaticDes.right+3, rcStaticDes.top, rcStaticDes.right+200, rcStaticDes.bottom+70); if(m_nPropertyID>=PROP_MEMBER_1)rcPropertyDes.right+=30; //创建字体 CFont font; VERIFY(font.CreateFont( 15, // nHeight 0, // nWidth 0, // nEscapement 0, // nOrientation FW_NORMAL, // nWeight FALSE, // bItalic FALSE, // bUnderline 0, // cStrikeOut ANSI_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily "Arial")); // lpszFacename //设置属性 dc.SetBkMode(TRANSPARENT); CFont* def_font = dc.SelectObject(&font); //描述信息 UINT nFormat = DT_LEFT | DT_TOP | DT_WORDBREAK; dc.DrawText(g_PropertyDescribe[m_nPropertyID].szName, rcPropertyName, nFormat); dc.DrawText(g_PropertyDescribe[m_nPropertyID].szDescribe, rcPropertyDes, nFormat); //删除资源 dc.SelectObject(def_font); font.DeleteObject(); }
//绘画界面 void CSkinWndObject::DrawSkinView(CDC * pDC) { //获取参数 CRect ClientRect; m_pWndHook->GetClientRect(&ClientRect); //建立缓冲图 CSkinImage CaptionImage; CaptionImage.Create(ClientRect.Width()-2*m_nXExcursionPos,m_SkinAttribute.m_nCaptionHeigth,16); if (CaptionImage.IsNull()) return; //绘画背景 CDC BufferDC; BufferDC.CreateCompatibleDC(NULL); BufferDC.SelectObject(CaptionImage); DrawCaption(&BufferDC,CaptionImage.GetWidth(),CaptionImage.GetHeight()); //建立 DC if (pDC==NULL) { CClientDC ClientDC(m_pWndHook); ClientDC.BitBlt(m_nXExcursionPos,1,CaptionImage.GetWidth(),CaptionImage.GetHeight(),&BufferDC,0,0,SRCCOPY); ClientDC.Draw3dRect(&ClientRect,RGB(0,0,0),RGB(0,0,0)); BufferDC.DeleteDC(); } else { pDC->BitBlt(m_nXExcursionPos,1,CaptionImage.GetWidth(),CaptionImage.GetHeight(),&BufferDC,0,0,SRCCOPY); pDC->Draw3dRect(&ClientRect,RGB(0,0,0),RGB(0,0,0)); } //获取标题 TCHAR strTitle[128]; GetWindowText(*m_pWndHook,strTitle,CountArray(strTitle)); //计算位置 INT nYPos=(m_SkinAttribute.m_nCaptionHeigth-12)/2+2; INT nXPos=46; //建立缓冲图 CClientDC ClientDC(m_pWndHook); ClientDC.SetBkMode(TRANSPARENT); ClientDC.SelectObject(m_SkinAttribute.m_DefaultFont); ClientDC.SetTextAlign(TA_LEFT); //变量定义 int nStringLength=lstrlen(strTitle); int nXExcursion[8]={1,1,1,0,-1,-1,-1,0}; int nYExcursion[8]={-1,0,1,1,1,0,-1,-1}; //绘画边框 ClientDC.SetTextColor(RGB(0,112,192)); for (int i=0;i<CountArray(nXExcursion);i++) { ClientDC.TextOut(nXPos+nXExcursion[i],nYPos+nYExcursion[i],strTitle,nStringLength); } //绘画标题m_SkinAttribute.m_crCaptionTXColor ClientDC.SetTextColor(RGB(255,255,255)); ClientDC.TextOut(nXPos,nYPos,strTitle); BufferDC.DeleteDC(); return; }
//绘画界面 void CSkinWndObject::DrawSkinView(CDC * pDC) { //获取参数 CRect ClientRect; m_pWndHook->GetClientRect(&ClientRect); //建立缓冲图 CSkinImage CaptionImage; CaptionImage.Create(ClientRect.Width(),m_SkinAttribute.m_nCaptionHeigth,24); if (CaptionImage.IsNull()) return; //绘画背景 CDC BufferDC; BufferDC.CreateCompatibleDC(NULL); BufferDC.SelectObject(CaptionImage); DrawCaption(&BufferDC,CaptionImage.GetWidth(),CaptionImage.GetHeight()); //建立 DC if (pDC==NULL) { CClientDC ClientDC(m_pWndHook); ClientDC.BitBlt(m_nXExcursionPos,0,CaptionImage.GetWidth(),CaptionImage.GetHeight(),&BufferDC,0,0,SRCCOPY); //ClientDC.Draw3dRect(&ClientRect,RGB(0,0,0),RGB(0,0,0)); BufferDC.DeleteDC(); } else { pDC->BitBlt(m_nXExcursionPos,0,CaptionImage.GetWidth(),CaptionImage.GetHeight(),&BufferDC,0,0,SRCCOPY); //pDC->Draw3dRect(&ClientRect,RGB(0,0,0),RGB(0,0,0)); } //获取标题 TCHAR strTitle[128]; GetWindowText(*m_pWndHook,strTitle,CountArray(strTitle)); //计算位置 INT nYPos=(m_SkinAttribute.m_nCaptionHeigth-12)/2+2; INT nXPos=35; //建立缓冲图 CClientDC ClientDC(m_pWndHook); ClientDC.SetBkMode(TRANSPARENT); ClientDC.SelectObject(m_SkinAttribute.m_DefaultFont); ClientDC.SetTextAlign(TA_LEFT); //变量定义 int nStringLength=lstrlen(strTitle); int nXExcursion[8]={1,1,1,0,-1,-1,-1,0}; int nYExcursion[8]={-1,0,1,1,1,0,-1,-1}; int nXExcursion1=GetXExcursionPos(); int nYExcursion1=GetYExcursionPos(); CImageHandle m_FramLeft(&m_SkinAttribute.m_FramLeft); if (m_SkinAttribute.m_FramLeft.IsNull()) return ; CImageHandle m_BottomM(&m_SkinAttribute.m_BottomM); if (m_SkinAttribute.m_BottomM.IsNull()) return ; CImageHandle m_FramRight(&m_SkinAttribute.m_FramRight); if (m_SkinAttribute.m_FramRight.IsNull()) return ; CImageHandle BottomL(&m_SkinAttribute.m_BottomL); if (m_SkinAttribute.m_BottomL.IsNull()) return ; CImageHandle BottomR(&m_SkinAttribute.m_BottomR); if (m_SkinAttribute.m_BottomR.IsNull()) return ; int nLeftWidth=m_FramLeft->GetHeight(); int nMidWidth=m_BottomM->GetWidth(); int nRightWidth=m_FramRight->GetHeight(); for (int i=ClientRect.top+CaptionImage.GetHeight();i<ClientRect.bottom-BottomL->GetHeight();i+=nLeftWidth) m_SkinAttribute.m_FramLeft.BitBlt(ClientDC,nXExcursion1,i); for (int i=ClientRect.top+CaptionImage.GetHeight();i<ClientRect.bottom-BottomR->GetHeight();i+=nRightWidth) m_SkinAttribute.m_FramRight.BitBlt(ClientDC,ClientRect.Width()-nXExcursion1-m_FramRight->GetWidth(),i); for (int i=nXExcursion1+BottomL->GetWidth();i<ClientRect.Width()-m_FramRight->GetWidth();i+=nMidWidth) m_SkinAttribute.m_BottomM.BitBlt(ClientDC,i,ClientRect.Height()-m_BottomM->GetHeight()); m_SkinAttribute.m_BottomL.BitBlt(ClientDC,0,ClientRect.Height()-BottomL->GetHeight()); m_SkinAttribute.m_BottomR.BitBlt(ClientDC,ClientRect.Width()-BottomR->GetWidth()-nXExcursion1,ClientRect.Height()-BottomR->GetHeight()); //绘画边框 // ClientDC.SetTextColor(RGB(231,192,137)); // for (int i=0;i<CountArray(nXExcursion);i++) // { // ClientDC.TextOut(nXPos,nYPos,strTitle,nStringLength); // } //CImageHandle TitleLeft1(&m_SkinAttribute.m_TitleLeft); //if (m_SkinAttribute.m_TitleLeft1.IsNull()) return ; //CImageHandle TitleMid1(&m_SkinAttribute.m_TitleMid); //if (m_SkinAttribute.m_TitleMid1.IsNull()) return ; //CImageHandle TitleRight1(&m_SkinAttribute.m_TitleRight); //if (m_SkinAttribute.m_TitleRight1.IsNull()) return ; //int nLeftWidth=TitleLeft1->GetHeight(); //int nMidWidth=TitleMid1->GetWidth(); //int nRightWidth=TitleRight1->GetWidth(); /*for (int i=ClientRect.top;i<ClientRect.bottom;i+=nLeftWidth) TitleLeft1->BitBlt(BufferDC.m_hDC,ClientRect.left,i);*/ /*for (int i=nLeftWidth;i<nXMinDrawPause;i+=nMidWidth) TitleMid1->BitBlt(pDC->m_hDC,i,0); TitleRight1->BitBlt(pDC->m_hDC,nXMinDrawPause,0);*/ //绘画标题m_SkinAttribute.m_crCaptionTXColor //ClientDC.SetTextColor(m_SkinAttribute.m_crCaptionTXColor); //ClientDC.TextOut(nXPos,nYPos,strTitle); /*for (int i=ClientRect.top;i<ClientRect.bottom;i+=nLeftWidth) TitleLeft1->BitBlt(BufferDC.m_hDC,ClientRect.left,i);*/ BufferDC.DeleteDC(); return; }