当前位置: 首页>>代码示例>>C++>>正文


C++ CPaintDC::DrawText方法代码示例

本文整理汇总了C++中CPaintDC::DrawText方法的典型用法代码示例。如果您正苦于以下问题:C++ CPaintDC::DrawText方法的具体用法?C++ CPaintDC::DrawText怎么用?C++ CPaintDC::DrawText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPaintDC的用法示例。


在下文中一共展示了CPaintDC::DrawText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawText

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);
}
开发者ID:FelGel,项目名称:BlueMagic,代码行数:8,代码来源:DepartmentEstimationDialog.cpp

示例2: OnPaint

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);
}
开发者ID:amitahire,项目名称:development,代码行数:17,代码来源:hello.cpp

示例3: OnPaint

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);
}
开发者ID:AdrianRys,项目名称:wsf,代码行数:20,代码来源:MyURLCtrl.cpp

示例4: DrawTextImpl

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);
}
开发者ID:strogo,项目名称:AppRunner,代码行数:21,代码来源:Separator.cpp

示例5: DrawEmptyView

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);
}
开发者ID:vividos,项目名称:RemotePhotoTool,代码行数:21,代码来源:PreviousImagesView.cpp

示例6: DrawImageInfos

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);
}
开发者ID:vividos,项目名称:RemotePhotoTool,代码行数:38,代码来源:PreviousImagesView.cpp

示例7: drawValues

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);
}
开发者ID:AlexLuya,项目名称:HPCC-Platform,代码行数:66,代码来源:inspectctrl.cpp


注:本文中的CPaintDC::DrawText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。