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


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

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


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

示例1: OnPaint

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);
	}

}
开发者ID:jiayuehua,项目名称:MFCProgramming,代码行数:29,代码来源:Hello.cpp

示例2: 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

示例3: OnPaint


//.........这里部分代码省略.........
	GetClientRect (rect);
	rect.DeflateRect (5, 5, 5, 5);

	if (pDoc->m_pStyle != NULL)
	{
		CCdCoverCreator2View* pView = (CCdCoverCreator2View*) pChild->GetActiveView ();
		if (pView == NULL)
			goto __end;

		int nHeight = (rect.Width () / 5) * 4;
		CRenderDC rdc (&dc, nHeight, pView->GetDocument ()->m_pStyle);

		m_y[Cover] = 5;
		m_y[Back] = m_y[Cover] + rdc.GetHeight (Cover) + 10;
		m_y[Inlay] = m_y[Back] + rdc.GetHeight (Back) + 10;
		m_y[Label] = m_y[Inlay] + rdc.GetHeight (Inlay) + 10;
		m_y[Booklet] = m_y[Label] + rdc.GetHeight (Label) + 10;

		if (m_bRedraw)
		{
			CLabelRenderer renderer (pDoc->m_pTracks, pDoc->m_pDataCDInfo,
				reinterpret_cast<CBackgroundInfo**> (&(pDoc->m_pBackground)),
				pDoc->m_listFloatingObjects, *(pDoc->m_pStyle));

			for (int i = 0; i < NUM_RENDER_TYPES - 1; i++)
			{
				if ((RenderType) i == Booklet)
					continue;

				CRect rectBmp (0, 0, rdc.GetWidth ((RenderType) i) + 5, /*nHeight*/(m_y[i + 1] - m_y[i]) + 5);

				m_Bitmap[i].DeleteObject ();
				m_Bitmap[i].CreateCompatibleBitmap (&dc, rectBmp.right, rectBmp.bottom);

				// render
				dcMem.SelectObject (&m_Bitmap[i]);
				dcMem.FillRect (rectBmp, &brush);

				renderer.Render (CRenderDC (&dcMem, nHeight, pDoc->m_pStyle), (RenderType) i, true);
			}

			m_bRedraw = false;
		}

		// draw the bitmaps
		int x[] = {
			(rect.Width () - rdc.GetWidth (Cover)) / 2 + 5,
			(rect.Width () - rdc.GetWidth (Back)) / 2 + 5,
			(rect.Width () - rdc.GetWidth (Inlay)) / 2 + 5,
			(rect.Width () - rdc.GetWidth (Label)) / 2 + 5,
			(rect.Width () - rdc.GetWidth (Cover)) / 2 + 5
		};

		dc.SetViewportOrg (x[Booklet], m_y[Booklet]);
		DrawBooklet (&dc, rdc.GetWidth (Cover), rdc.GetWidth (Cover) / 2, pDoc, pView->GetRenderType ());
		dc.SetViewportOrg (0, 0);

		CBrush* pOldBrush = dc.GetCurrentBrush ();

		for (int i = 0; i < NUM_RENDER_TYPES; i++)
		{
			CRect rectArea (rect.left, m_y[i], rect.right,
				m_y[i] + ((RenderType) i == Booklet ? rdc.GetWidth (Cover) / 2 : rdc.GetHeight ((RenderType) i)));

			if ((RenderType) i != Booklet)
			{
				dcMem.SelectObject (m_Bitmap[i]);

				if (pDoc->m_pStyle->m_bHasRenderType[i])
					dc.SelectStockObject (WHITE_BRUSH);
				else
				{
					dc.SetTextColor (RGB (0xff, 0xff, 0xff));
					dc.SetBkColor (RGB (0x7f, 0x7f, 0x7f));
					dc.SelectObject (dc.GetHalftoneBrush ());
				}

				//dc.BitBlt (x[i], m_y[i], rdc.GetWidth ((RenderType) i) + 5, /*nHeight*/(m_y[i + 1] - m_y[i]) + 5, &dcMem, 0, 0, MERGECOPY);
				dc.BitBlt (x[i], m_y[i], rectArea.Width (), rectArea.Height () + 4, &dcMem, 0, 0, MERGECOPY);
			}

			// marker
			Mark (&dc, rectArea, pView->GetRenderType () != (RenderType) i);
		}

		dc.SelectObject (pOldBrush);
	}

__end:

#ifdef PEROUTKA_FEDORISIN
	CBitmap* pOldBmp = (CBitmap*) dcMem.SelectObject (m_bmpLogo);
	dc.FillSolidRect (0, r.bottom - 32, 148, 32, RGB (0xff, 0xff, 0xff));
	dc.BitBlt ((148 - 80) / 2, r.bottom - 32, 80, 32, &dcMem, 0, 0, SRCCOPY);
//	dcMem.SelectObject (pOldBmp);
#endif

	dcMem.DeleteDC ();
	brush.DeleteObject ();
}
开发者ID:matthias-christen,项目名称:CdCoverCreator,代码行数:101,代码来源:LeftPanelDlgBar.cpp


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