void CMainWindow::OnPaint () { CRect rect; GetClientRect(&rect); CPaintDC dc (this); dc.SetViewportOrg(rect.Width()/2, rect.Height()/2); dc.SetBkMode(TRANSPARENT); for (int i = 0; i<300; i+=150) { LOGFONT lf; ::ZeroMemory(&lf, sizeof(LOGFONT)); lf.lfHeight = 160; lf.lfHeight = FW_BOLD; lf.lfEscapement = i; lf.lfOrientation = i; ::lstrcpy(lf.lfFaceName, _T("Arial")); CFont font; font.CreateFontIndirect(&lf); CFont * pOldFont = dc.SelectObject(&font); dc.TextOut(0,0, CString(_T("M"))); dc.SelectObject(pOldFont); } }
void CAimComboCtrl::OnPaint () { CRect rect; CPaintDC dc (this); GetClientRect (&rect); m_rectBtn = rect; m_rectBtn.left = rect.right - 13; m_rectText = rect; m_rectText.right = rect.right - 13; m_rectText.DeflateRect (2, 1); dc.FillSolidRect (rect, ::GetSysColor (COLOR_WINDOW)); dc.FillSolidRect (m_rectBtn, ::GetSysColor (COLOR_BTNFACE)); dc.DrawIcon (m_rectBtn.CenterPoint () - CSize (5, 5), theApp.LoadIcon (IDI_PIC_DOWNARROW)); dc.DrawEdge (m_rectBtn, BDR_RAISEDINNER, BF_RECT); CDC dcMem; dcMem.CreateCompatibleDC (&dc); CBitmap *pOld = dcMem.GetCurrentBitmap (); dcMem.SelectObject (m_pbmpImage); dc.SetBkMode (TRANSPARENT); //dc.SetROP2 (R2_NOP); //dc.SetStretchBltMode (STRETCH_HALFTONE); //dc.StretchBlt (m_rectText.left, m_rectText.top, m_rectText.Width(), m_rectText.Height (), &dcMem, 0, 0, // 16, 16, SRCCOPY); dcMem.SelectObject (pOld); dcMem.DeleteDC (); Paint (dc); }
void CDepartmentEstimationDialog::DrawText(CPaintDC &dc, CString Text, COLORREF Color, int l, int t, int r, int b) { CRect TextRect(l, t, r, b); dc.SetTextColor(Color); dc.SetBkMode( TRANSPARENT ); dc.DrawText(Text, &TextRect, DT_SINGLELINE | DT_CENTER); }
void CMyURLCtrl::OnPaint (void) { CPaintDC dc (this); // Set Current Drawing Properties CFont* pCurrentFont = dc.SelectObject (&o_Font); COLORREF crCurrentTextColor = dc.SetTextColor (RGB (0, 0, 255)); CRect rc; GetWindowRect (&rc); ScreenToClient (rc); dc.SetBkMode (TRANSPARENT); dc.DrawText (s_Text, rc, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_END_ELLIPSIS); // Reset Drawing Properties dc.SelectObject (pCurrentFont); dc.SetTextColor (crCurrentTextColor); }
void CMainWindow::OnPaint () { CPaintDC dc (this); // // Initialize the device context. // dc.SetMapMode (MM_LOENGLISH); dc.SetTextAlign (TA_CENTER | TA_BOTTOM); dc.SetBkMode (TRANSPARENT); // // Draw the body of the ruler. // CBrush brush (RGB (255, 255, 0)); CBrush* pOldBrush = dc.SelectObject (&brush); dc.Rectangle (100, -100, 1300, -200); dc.SelectObject (pOldBrush); // // Draw the tick marks and labels. // for (int i=125; i<1300; i+=25) { dc.MoveTo (i, -192); dc.LineTo (i, -200); } for (i=150; i<1300; i+=50) { dc.MoveTo (i, -184); dc.LineTo (i, -200); } for (i=200; i<1300; i+=100) { dc.MoveTo (i, -175); dc.LineTo (i, -200); CString string; string.Format (_T ("%d"), (i / 100) - 1); dc.TextOut (i, -175, string); } }
void PreviousImagesView::DrawImageInfos(CPaintDC& dc, int iWidth) { std::shared_ptr<PreviousImageInfo> spCurrentImage = m_spCurrentImage; if (spCurrentImage == nullptr) return; CRect rcPaint; GetClientRect(&rcPaint); rcPaint.left = iWidth + c_uiPaddingImageInfo; rcPaint.top += c_uiPaddingImageInfo; HFONT oldFont = dc.SelectFont(GetFont()); dc.SetBkMode(TRANSPARENT); dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT)); CString cszText; cszText.Format( _T("Filename: %s\n") _T("Av: %s\n") _T("Tv: %s\n") _T("ISO: %s\n") _T("Zoom: %s\n") _T("Date: %s\n") _T("%s"), spCurrentImage->Filename().GetString(), spCurrentImage->InfoText(PreviousImageInfo::typeAperture).GetString(), spCurrentImage->InfoText(PreviousImageInfo::typeShutterSpeed).GetString(), spCurrentImage->InfoText(PreviousImageInfo::typeIsoSetting).GetString(), spCurrentImage->InfoText(PreviousImageInfo::typeFocalLength).GetString(), spCurrentImage->InfoText(PreviousImageInfo::typeDateTime).GetString(), spCurrentImage->InfoText(PreviousImageInfo::typeFlashFired).GetString()); dc.DrawText(cszText, cszText.GetLength(), rcPaint, DT_LEFT | DT_TOP); dc.SelectFont(oldFont); }
void CInspectorTreeCtrl::drawValues(CPaintDC & dc) { CRect rect; GetWindowRect(rect); dc.SetViewportOrg(0, 0); dc.SelectObject(linePen); dc.SetBkMode(TRANSPARENT); dc.SelectObject(GetFont()); dc.SetTextColor(color_windowtext); DRAWLINE(0, 0, rect.right, 0); int cWid0 = getColumnWidth(0); int cWid1 = getColumnWidth(1); int height = 0; HTREEITEM hItemFocus = GetSelectedItem(); HTREEITEM hItem = GetFirstVisibleItem(); while(hItem && height < rect.Height()) { CRect iRect; GetItemRect(hItem, &iRect, FALSE); DRAWLINE(0, iRect.bottom, rect.right, iRect.bottom); height += iRect.Height(); CTreeListItem * itemData = GetTreeListItem(hItem); if(itemData) { iRect.left = cWid0 + 6; iRect.right = cWid0 + cWid1; if(hItem == hItemFocus) { CRect whitespaceRect; GetItemRect(hItem, &whitespaceRect, TRUE); if(whitespaceRect.right < cWid0) { whitespaceRect.left = whitespaceRect.right; whitespaceRect.right = cWid0; CWnd * focusWnd = GetFocus(); if(focusWnd && (focusWnd->m_hWnd == m_hWnd)) // I have focus dc.FillRect(whitespaceRect, &whitespaceHighlightBrush_Focused); else dc.FillRect(whitespaceRect, &whitespaceHighlightBrush_Unfocused); } CString xpath; getTypeText(itemData->getType(), xpath, true); if(getFullXPath(hItem, xpath)) { CRect itemRect, r; GetItemRect(hItem, &itemRect, FALSE); r.UnionRect(&itemRect, &whitespaceRect); tooltipCtrl->DelTool(this, TREE_TOOLTIP_ID); tooltipCtrl->AddTool(this, xpath, r, TREE_TOOLTIP_ID); } } dc.DrawText(itemData->getValue(), &iRect, DT_SINGLELINE | DT_LEFT); } hItem = GetNextVisibleItem(hItem); } DRAWLINE(cWid0, 0, cWid0, height); }