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);
}
Example #2
0
void CMainWindow::OnPaint()
{
	// Paint handler device context to THIS window!
	CPaintDC	dc (this);
	CRect		rect;

	// current bounding rectangle of entire client area...


	GetClientRect (&rect);

	
	dc.DrawText("Hello, mo fo.", 
				-1 , 
				&rect,
				DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
Example #3
0
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);
}
Example #4
0
void CSeparator::DrawTextImpl(CPaintDC &dc, CString text, CRect clientRect)
{
   auto &g = Globals::Instance();

   HFONT hOldFont = dc.SelectFont(g.sep.font);

   dc.SetTextColor(g.sep.textColor);
   dc.SetBkColor(g.bkColor);

   const int margin = 0;
   CSize textSize;
   dc.GetTextExtent(text, -1, &textSize);
   CRect textRect(clientRect);
   textRect.left = margin;
   textRect.right = textRect.left + textSize.cx + 2 * 3;
   dc.FillSolidRect(textRect, g.bkColor);
   textRect.InflateRect(-3, 0);
   dc.DrawText(text, -1, textRect, DT_VCENTER | DT_CENTER | DT_SINGLELINE);

   dc.SelectFont(hOldFont);
}
void PreviousImagesView::DrawEmptyView(CPaintDC& dc)
{
   DWORD dwColor = ::GetSysColor(COLOR_APPWORKSPACE);
   dc.FillSolidRect(&dc.m_ps.rcPaint, dwColor);

   // output "no image" string
   CRect rcClient;
   GetClientRect(&rcClient);

   HFONT oldFont = dc.SelectFont(GetFont());

   dc.SetBkColor(dwColor);
   dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));

   CString cszText = m_manager.ImagesAvail() ? _T("<Loading image...>") : _T("<No images available>");

   // add DT_SINGLELINE to center both vertically and horizontally
   dc.DrawText(cszText, cszText.GetLength(), rcClient, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

   dc.SelectFont(oldFont);
}
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);
}
Example #7
0
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);
}