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


C++ CBrush::CreateStockObject方法代码示例

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


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

示例1: DrawAd

void CHeaderDockPane::DrawAd(CPaintDC & dc)
{
	//CPaintDC dc(this); 
	//CDC pDC;
	//pDC.CreateCompatibleDC(&dc);

	CRect rect;
	GetClientRect(&rect);

	if(rect.right > 500)
	{
		CBrush bg;
		bg.CreateStockObject(RGB(0,0,0));
		CBrush fillBrush(RGB(250, 0, 0));
		CBrush *oldFillBrush = dc.SelectObject(&fillBrush);
		//rect = CRect( CPoint(rect.left, rect.top), CPoint(rect.right, rect.bottom - 2) );
		//rect = CRect( CPoint(200, 5), CPoint(400, 25) );
		//dc.FillRect(&rect, &bg);


		int height = 22;
		int progress_x = rect.right - 300 - 1;
		int progress_y = -22;
		CPoint prorgess_border_points[5];
		prorgess_border_points[0] = CPoint(progress_x, progress_y);
		prorgess_border_points[1] = CPoint(progress_x, progress_y + height);
		prorgess_border_points[2] = CPoint(progress_x+(rect.right - progress_x)-20 - 1, progress_y + height);
		prorgess_border_points[3] = CPoint(progress_x+(rect.right - progress_x)-20 - 1, progress_y);
		prorgess_border_points[4] = CPoint(progress_x, progress_y);
		CPen penOutline(PS_SOLID, 1, RGB(175, 175, 175));
		dc.SelectObject(&penOutline);
		dc.Polyline(prorgess_border_points, 5);

	}
}
开发者ID:Omgan,项目名称:RealFTP.net,代码行数:35,代码来源:HeaderDock.cpp

示例2: OnPaint

void CHeaderDockPane::OnPaint()
{
	CPaintDC dc(this); 
	CDC pDC;
	pDC.CreateCompatibleDC(&dc);
	// device context for painting
	// TODO: Add your message handler code here
	// Do not call CDockablePane::OnPaint() for painting messages
	
	CRect rect;
	GetClientRect(&rect);
	//Manual BG repaint
	CBrush bg;
	bg.CreateStockObject(RGB(236,236,236));
	//CPen penFill(PS_NULL,0,RGB(250,0,0));
	//dc.SelectObject(&penFill);
	CBrush fillBrush(RGB(236, 236, 236));
	CBrush *oldFillBrush = dc.SelectObject(&fillBrush);
	dc.FillRect(&rect, &bg);
	//dc.Ellipse(&rect);
	
	//DrawAd(dc);

	//Invalidate();
}
开发者ID:Omgan,项目名称:RealFTP.net,代码行数:25,代码来源:HeaderDock.cpp

示例3: DrawItem

void CComboColorPicker::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDC dc;
	CBrush brushBlack;
	brushBlack.CreateStockObject(BLACK_BRUSH);
	
	if (!dc.Attach(lpDrawItemStruct->hDC))
		return;

	COLORREF rgbTextColor = dc.GetTextColor();
	COLORREF rgbBkColor = dc.GetBkColor();

	if (lpDrawItemStruct->itemAction & ODA_FOCUS)
	{
		dc.DrawFocusRect(&lpDrawItemStruct->rcItem);
	}
	else if (lpDrawItemStruct->itemAction & ODA_DRAWENTIRE)
	{
		if (lpDrawItemStruct->itemState & ODS_FOCUS)
			dc.DrawFocusRect(&lpDrawItemStruct->rcItem);
		else
			dc.ExtTextOut(0, 0, ETO_OPAQUE, &lpDrawItemStruct->rcItem, _T(""), 0, NULL);
	}

	if (0 <= (int)lpDrawItemStruct->itemID)	// Any item selected?
	{
		::InflateRect(&lpDrawItemStruct->rcItem, -2, -2);

		if( (COLORREF)lpDrawItemStruct->itemData == 0xFFFFFFFF )
		{
			CSize	textSize = dc.GetTextExtent( _T("default") );
			dc.FillSolidRect( &lpDrawItemStruct->rcItem, RGB( 0xFF, 0xFF, 0xFF ) );
			dc.FrameRect( &lpDrawItemStruct->rcItem, &brushBlack );

			dc.SetTextColor( RGB( 0x00, 0x00, 0x00 ) );
			dc.SetBkColor( RGB( 0xFF, 0xFF, 0xFF ) );
			dc.SetTextAlign( TA_CENTER | TA_TOP | TA_NOUPDATECP );
			dc.TextOut( 
				lpDrawItemStruct->rcItem.left + (lpDrawItemStruct->rcItem.right - lpDrawItemStruct->rcItem.left) / 2, 
				lpDrawItemStruct->rcItem.top +
					((lpDrawItemStruct->rcItem.bottom - lpDrawItemStruct->rcItem.top) / 2) -
					(textSize.cy / 2), 
				_T("default") );
		}
		else
		{
			dc.FillSolidRect(&lpDrawItemStruct->rcItem, (COLORREF)lpDrawItemStruct->itemData);
			dc.FrameRect(&lpDrawItemStruct->rcItem, &brushBlack);
		}
	}

	// Restore the DC state
	dc.SetTextColor(rgbTextColor);
	dc.SetBkColor(rgbBkColor);
	dc.Detach();
}
开发者ID:bzindovic,项目名称:texniccenter-code,代码行数:56,代码来源:ComboColorPicker.cpp

示例4: DrawItem

void CBigIcon::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
	ASSERT(pDC != NULL);

	CRect rect;
	GetClientRect(rect);
	int cxClient = rect.Width();
	int cyClient = rect.Height();

	// load icon
	HICON hicon = AfxGetApp()->LoadIcon(ID_SYM_ICON_GDB);
	if (hicon == NULL)
		return;

	// draw icon into off-screen bitmap
	int cxIcon = ::GetSystemMetrics(SM_CXICON);
	int cyIcon = ::GetSystemMetrics(SM_CYICON);

	CBitmap bitmap;
	if (!bitmap.CreateCompatibleBitmap(pDC, cxIcon, cyIcon))
		return;
	CDC dcMem;
	if (!dcMem.CreateCompatibleDC(pDC))
		return;
	CBitmap* pBitmapOld = dcMem.SelectObject(&bitmap);
	if (pBitmapOld == NULL)
		return;

	// blt the bits already on the window onto the off-screen bitmap
	dcMem.StretchBlt(0, 0, cxIcon, cyIcon, pDC,
		2, 2, cxClient-CX_SHADOW-4, cyClient-CY_SHADOW-4, SRCCOPY);

	// draw the icon on the background
	dcMem.DrawIcon(0, 0, hicon);

	// draw border around icon
	CPen pen;
	pen.CreateStockObject(BLACK_PEN);
	CPen* pPenOld = pDC->SelectObject(&pen);
	pDC->Rectangle(0, 0, cxClient-CX_SHADOW, cyClient-CY_SHADOW);
	if (pPenOld)
		pDC->SelectObject(pPenOld);

	// draw shadows around icon
	CBrush br;
	br.CreateStockObject(DKGRAY_BRUSH);
	rect.SetRect(cxClient-CX_SHADOW, CY_SHADOW, cxClient, cyClient);
	pDC->FillRect(rect, &br);
	rect.SetRect(CX_SHADOW, cyClient-CY_SHADOW, cxClient, cyClient);
	pDC->FillRect(rect, &br);

	// draw the icon contents
	pDC->StretchBlt(2, 2, cxClient-CX_SHADOW-4, cyClient-CY_SHADOW-4,
		&dcMem, 0, 0, cxIcon, cyIcon, SRCCOPY);
}
开发者ID:kjseefried,项目名称:pm3,代码行数:56,代码来源:aboutbox.cpp

示例5: OnDraw

void CQueView::OnDraw(CDC* pDC)
{
    CDrawDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);

    CBitmap bitmap;
    CBitmap *pOldBitmap;

    // only paint the rect that needs repainting
    CRect client;
    pDC->GetClipBox(client);
    CRect rect;
    GetClientRect(&rect);

    CDC bitmapDC;
    auto pDrawDC = pDC;
    // draw to offscreen bitmap for fast looking repaints
    if (bitmapDC.CreateCompatibleDC(pDC)) {
        if (bitmap.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height())) {
            OnPrepareDC(&bitmapDC, nullptr);
            pDrawDC = &bitmapDC;

            // offset origin more because bitmap is just piece of the whole drawing
            //..,,	dc.OffsetViewportOrg(-rect.left, -rect.top);
            bitmapDC.OffsetViewportOrg(-rect.left, -rect.top);
            pOldBitmap = bitmapDC.SelectObject(&bitmap);

            // might as well clip to the same rectangle
            bitmapDC.IntersectClipRect(client);
        }
    }

    // paint background
    CBrush brush;
    if (!brush.CreateStockObject(WHITE_BRUSH))
        return;

    pDrawDC->FillRect(client, &brush);

    pDoc->DrawQue(pDrawDC, this);

    if (pDrawDC != pDC) {
        pDC->SetMapMode(MM_TEXT);
        bitmapDC.SetMapMode(MM_TEXT);
        pDC->BitBlt(rect.left, rect.top, rect.Width(), rect.Height(), pDrawDC, 0, 0, SRCCOPY);
        bitmapDC.SelectObject(pOldBitmap);
    }
}
开发者ID:vSzemkel,项目名称:Manam,代码行数:48,代码来源:QueView.cpp

示例6: OnPaint

void CSimplexDlg::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO:  在此处添加消息处理程序代码

	CPen pen; //定义画笔对象
	CBrush brush; //定义笔刷对象
	pen.CreatePen(PS_DASHDOT, 1, RGB(0, 0, 255)); //创建初始化画笔
	brush.CreateStockObject(NULL_BRUSH); //初始化实心的空画刷(没有背景颜色)
	dc.SelectObject(&brush); //将画刷选入dc
	dc.SelectObject(&pen);  //将画笔选入dc
	dc.SetBkMode(TRANSPARENT); //设置背景模式为透明,也可以使用SetBkColor设置背景色
	dc.Rectangle(15, 20, 500, 430); //创建一个透明的文本框

	// 不为绘图消息调用 CDialogEx::OnPaint()
}
开发者ID:maoxiaoke,项目名称:menufortest_Server,代码行数:16,代码来源:SimplexDlg.cpp

示例7: OnPaint

void CChildView::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	CPen* oldpen = dc.GetCurrentPen();
	CBrush* oldbrush = dc.GetCurrentBrush();

	DrawTree(dc, false);

	//draw intersect test segment
	if (_intersectsegment.IsDefine())
	{
		CPen intersectPen(PS_SOLID, 1, RGB(255, 0, 0));
		CPen noneintersectPen(PS_SOLID, 1, RGB(0, 55, 55));

		dc.MoveTo(static_cast<int>(_intersectsegment.GetOrigin().x), static_cast<int>(_intersectsegment.GetOrigin().y));
		if (_intersecT != 0.0f && _intersecT < 1.0f)
		{
			dc.SelectObject(&intersectPen);
			Vector2Df intersectpoint = _intersectsegment.GetOrigin() + _intersectsegment.GetFullLengthDirection() * _intersecT;
			Vector2Di ip(static_cast<int>(intersectpoint.x), static_cast<int>(intersectpoint.y));
			dc.LineTo(ip.x, ip.y);
			int w = 3;
			dc.Ellipse(ip.x - w, ip.y - w, ip.x + w, ip.y + w);
		}

		dc.SelectObject(&noneintersectPen);
		Vector2Df endpoint = _intersectsegment.GetDestination();
		dc.LineTo(static_cast<int>(endpoint.x), static_cast<int>(endpoint.y));
	}

	//draw all obstacles
	CPen shapePen(PS_SOLID, 1, RGB(255, 0, 0));
	dc.SelectObject(&shapePen);

	CBrush brush;
	brush.CreateStockObject(NULL_BRUSH);
	dc.SelectObject(&brush);
	
	for_each(_obstacles.begin(), _obstacles.end(), [&dc](shared_ptr<CObstacle> o)	{ o->Draw(dc); });
	

	dc.SelectObject(oldpen);
	dc.SelectObject(oldbrush);
	// Do not call CWnd::OnPaint() for painting messages
}
开发者ID:Isuroku,项目名称:QuadTreeDemo,代码行数:46,代码来源:ChildView.cpp

示例8: DrawDrag

void CSplitterCursor::DrawDrag(void)
{
	CDC* pDC = m_pWnd->GetDC();
	if (pDC != NULL)
	{
		CRect crRect;
		m_pWnd->GetClientRect(&crRect);
		crRect.left = m_nX-1;
		crRect.right = crRect.left+1;

		CBrush cbDrag;
		cbDrag.CreateStockObject(LTGRAY_BRUSH);
		pDC->SelectObject(&cbDrag);

		pDC->PatBlt(crRect.left, crRect.top, crRect.Width(), crRect.Height(), PATINVERT);

		m_pWnd->ReleaseDC(pDC);
	}
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:19,代码来源:SPLITTER.CPP

示例9: DrawItem

void CBigIcon::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
	ASSERT(pDC != NULL);
	if (pDC != NULL)
	{
		CRect rect;
		GetClientRect(rect);
		int cxClient = rect.Width();
		int cyClient = rect.Height();

		// draw border around icon
		CPen pen;
		pen.CreateStockObject(BLACK_PEN);
		CPen* pPenOld = pDC->SelectObject(&pen);
		pDC->Rectangle(0, 0, cxClient-CX_SHADOW, cyClient-CY_SHADOW);
		if (pPenOld)
			pDC->SelectObject(pPenOld);

		// draw shadows around icon
		CBrush br;
		br.CreateStockObject(DKGRAY_BRUSH);
		rect.SetRect(cxClient-CX_SHADOW, CY_SHADOW, cxClient, cyClient);
		pDC->FillRect(rect, &br);
		rect.SetRect(CX_SHADOW, cyClient-CY_SHADOW, cxClient, cyClient);
		pDC->FillRect(rect, &br);

		// draw the bitmap contents
		CDC dcMem;
		if (!dcMem.CreateCompatibleDC(pDC))
			return;
		CBitmap* pBitmapOld = dcMem.SelectObject(&m_bitmap);
		if (pBitmapOld == NULL)
			return;

		pDC->BitBlt(2, 2, m_sizeBitmap.cx, m_sizeBitmap.cy, &dcMem, 0, 0, SRCCOPY);

		dcMem.SelectObject(pBitmapOld);
	}
}
开发者ID:jetlive,项目名称:skiaming,代码行数:40,代码来源:splash.cpp

示例10: DrawFocusItem

void CUploadListCtrl::DrawFocusItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);

	CBrush brushObj;
	brushObj.CreateStockObject(WHITE_BRUSH);
	CBrush* pOldBrushObj = pDC->SelectObject(&brushObj);

	CPen penObj;
	penObj.CreatePen(PS_SOLID, 1, RGB(152, 181, 226));
	CPen* pOldPenObj = pDC->SelectObject(&penObj);

	pDC->Rectangle(&lpDrawItemStruct->rcItem);

	pDC->SelectObject(pOldBrushObj);
	pDC->SelectObject(pOldPenObj);

	penObj.DeleteObject();
	brushObj.DeleteObject();

	DrawItemInfo(lpDrawItemStruct);
}
开发者ID:NickeyWoo,项目名称:EditorAssistant,代码行数:22,代码来源:UploadListCtrl.cpp

示例11: OnPaint

void CTipDlg::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	// Get paint area for the big static control
	CWnd* pStatic = GetDlgItem(IDC_BULB);
	CRect rect;
	pStatic->GetWindowRect(&rect);
	ScreenToClient(&rect);

	// Paint the background white.
	CBrush brush;
	brush.CreateStockObject(WHITE_BRUSH);
	dc.FillRect(rect, &brush);
	dc.FillSolidRect(rect, RGB(255, 255, 255));

	// Load bitmap and get dimensions of the bitmap
	CBitmap bmp;
	bmp.LoadBitmap(IDB_LIGHTBULB);
	BITMAP bmpInfo;
	bmp.GetBitmap(&bmpInfo);

	// Draw bitmap in top corner and validate only top portion of window
	CDC dcTmp;
	dcTmp.CreateCompatibleDC(&dc);
	dcTmp.SelectObject(&bmp);
	rect.bottom = bmpInfo.bmHeight + rect.top;
	dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(), 
		&dcTmp, 0, 0, SRCCOPY);

	// Draw out "Did you know..." message next to the bitmap
	CString strMessage;
	VERIFY(strMessage.LoadString(CG_IDS_DIDYOUKNOW));
	rect.left += bmpInfo.bmWidth;
	dc.DrawText(strMessage, rect, DT_VCENTER | DT_SINGLELINE);

	// Do not call CDialog::OnPaint() for painting messages
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:38,代码来源:Tipdlg.cpp

示例12: OnDraw

void CMiniCADView::OnDraw(CDC* pDC)
{
	CMiniCADDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	
	//v1.1
	//char info[100] = "F1-Line  F2-Rect  F3-Circle  F4-Ellipse  F5-PencilPath";
	//pDC->TextOut(0, 0, info);

	CBrush brsn;
	brsn.CreateStockObject(NULL_BRUSH);
	CBrush *oldBrsh = pDC->SelectObject(&brsn);

	for (int i = 0; i < m_Graphic.GetSize(); ++i)
	{
		CGraphic *aGraphic = (CGraphic *)m_Graphic[i];
		aGraphic->drawGraphic(pDC);
	}
	
	brsn.DeleteObject();
	pDC->SelectObject(oldBrsh);
}
开发者ID:CubeSugar,项目名称:WangDaoCurriculum,代码行数:23,代码来源:miniCADView.cpp

示例13: OnPaint

void CTipDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		if( cxIcon == 16 && cyIcon == 16 )
		{
			dc.DrawIcon( x, y, theApp.hMainIconSmall );
		}
		else
		{
			dc.DrawIcon( x, y, theApp.hMainIconBig );
		}
		return;
	}

	CPaintDC dc(this); // device context for painting

	// Get paint area for the big static control
	CWnd* pStatic = GetDlgItem(IDC_FRAME_INTERNAL);
	CRect rect;
	pStatic->GetWindowRect(&rect);
	ScreenToClient(&rect);

	// Paint the background white.
	CBrush brush;
	brush.CreateStockObject(WHITE_BRUSH);
	dc.FillRect(rect, &brush);

	// Load bitmap and get dimensions of the bitmap
	CBitmap bmp;
	bmp.LoadBitmap(IDB_LIGHTBULB);
	BITMAP bmpInfo;
	ZeroMemory( &bmpInfo, sizeof(bmpInfo) );
	bmp.GetBitmap(&bmpInfo);

	// Draw bitmap in top corner and validate only top portion of window
	CDC dcTmp;
	dcTmp.CreateCompatibleDC(&dc);
	dcTmp.SelectObject(&bmp);
	rect.bottom = bmpInfo.bmHeight + rect.top;
	dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(), 
		&dcTmp, 0, 0, SRCCOPY);

	// Draw out "Did you know..." message next to the bitmap
	CString strMessage;
	strMessage = LocLoadString(IDS_TIPS_DIDYOUKNOW);
	rect.left += bmpInfo.bmWidth;
	dc.SetBkMode( TRANSPARENT );
	dc.DrawText(strMessage, rect, DT_VCENTER | DT_SINGLELINE);

	// Do not call CDialog::OnPaint() for painting messages
}
开发者ID:kolomenkin,项目名称:TaskManagerEx,代码行数:65,代码来源:TipDlg.cpp

示例14: OnMouseMove

void CMiniCADView::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CClientDC cldc(this);
	
	CBrush brsn;
	brsn.CreateStockObject(NULL_BRUSH);
	CBrush *oldBrsh = cldc.SelectObject(&brsn);
	
	if (nFlags)
	switch (m_GrphcType)
	{
	case LINE:
		{
			CPoint ptl;
			if (MK_SHIFT & nFlags)
			{
				CSize dp = point - m_ptBegin;
				if (abs(dp.cy) <= abs(dp.cx) / 2)
				{
					ptl.x = m_ptBegin.x + dp.cx;
					ptl.y = m_ptBegin.y;
				}
				else if(((abs(dp.cx) / 2) < abs(dp.cy)) && (abs(dp.cy) < (abs(dp.cx) * 2)))
				{
					int dy = (dp.cy >= 0) ? abs(dp.cx) : -abs(dp.cx);
					ptl.x = m_ptBegin.x + dp.cx;
					ptl.y = m_ptBegin.y + dy;
				}
				else if((abs(dp.cx) * 2) <= abs(dp.cy))
				{
					ptl.x = m_ptBegin.x;
					ptl.y = m_ptBegin.y + dp.cy;
				}
			}
			else
			{
				ptl = point;
			}
			{
				cldc.SetROP2(R2_NOT);
				
				cldc.MoveTo(m_ptBegin);
				cldc.LineTo(ptl);
				
				cldc.MoveTo(m_ptBegin);
				cldc.LineTo(m_ptEnd);
				m_ptEnd = ptl;
			}
		}
		break;

	case RECTANGLE:
		{
			cldc.SetROP2(R2_NOT);
			CPoint pntr;
			CSize dp = point - m_ptBegin;

			if (MK_SHIFT & nFlags)
			{
				int y = (dp.cy >= 0) ? abs(dp.cx) : -abs(dp.cx);
				pntr.x = m_ptBegin.x + dp.cx;
				pntr.y = m_ptBegin.y + y;
			}
			else
			{
				pntr = point;
			}

			cldc.Rectangle(m_ptBegin.x, m_ptBegin.y, pntr.x, pntr.y);

			cldc.Rectangle(m_ptBegin.x, m_ptBegin.y, m_ptEnd.x, m_ptEnd.y);
			m_ptEnd = pntr;
		}
		break;

	case ELLIPSE:
		{
			cldc.SetROP2(R2_NOT);
			
			if (MK_SHIFT & nFlags)
			{
				CSize dp1 = point - m_ptBegin;
				double r1 = sqrt((dp1.cx * dp1.cx) + (dp1.cy * dp1.cy));
				int x1 = m_ptBegin.x - r1;
				int y1 = m_ptBegin.y - r1;
				int x2 = m_ptBegin.x + r1;
				int y2 = m_ptBegin.y + r1;

				cldc.Ellipse(x1, y1, x2, y2);

				CSize dp2 = m_ptEnd - m_ptBegin;
				double r2 = sqrt((dp2.cx * dp2.cx) + (dp2.cy * dp2.cy));
				int x3 = m_ptBegin.x - r2;
				int y3 = m_ptBegin.y - r2;
				int x4 = m_ptBegin.x + r2;
				int y4 = m_ptBegin.y + r2;

				cldc.Ellipse(x3, y3, x4, y4);
			}
//.........这里部分代码省略.........
开发者ID:CubeSugar,项目名称:WangDaoCurriculum,代码行数:101,代码来源:miniCADView.cpp

示例15: OnPaint

/////////////////////////////////////////////////////////////////////////////
// CCtlTipOfTheDayText message handlers
void CCtlTipOfTheDayText::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
  // get rectangle of the text area inside dialog
  RECT rectWin;
  GetWindowRect(&rectWin);
  ScreenToClient(&rectWin);

  // calculate positions of the upper and left rectangle and separating line
  int iy, ix0, ix1;
  RECT rectUp;
  RECT rectDn;
  ix0 = rectUp.left = rectDn.left = rectWin.left;
  ix1 = rectUp.right = rectDn.right = rectWin.right;
  iy = rectUp.bottom = rectDn.top = int((rectWin.bottom+rectWin.top)*0.25f);
  rectUp.top = rectWin.top;
  rectDn.bottom = rectWin.bottom;
  InflateRect(&rectDn, -5,-10);
  InflateRect(&rectUp, -5,-10);
  OffsetRect(&rectDn, 0,5);
  OffsetRect(&rectUp, 0,5);

  // draw white rectangle with sunken edge
  CBrush brWhite;
  brWhite.CreateStockObject(WHITE_BRUSH);
  dc.FillRect(&rectWin, &brWhite);
  dc.DrawEdge(&rectWin, BDR_SUNKENOUTER, BF_RIGHT|BF_BOTTOM|BF_TOP);

  // draw separating line
  CBrush brGray;
  brGray.CreateStockObject(GRAY_BRUSH);
  dc.SelectObject(brGray);
  dc.MoveTo(ix0-1, iy);
  dc.LineTo(ix1, iy);

  // create two fonts, big and small
  LOGFONT lf;

  ::ZeroMemory (&lf, sizeof (lf));
  lf.lfHeight = 145;
  lf.lfWeight = FW_BOLD;
  lf.lfItalic = FALSE;
  wcscpy(lf.lfFaceName, L"Times New Roman");
  CFont fontBig;
  fontBig.CreatePointFontIndirect (&lf);

  ::ZeroMemory (&lf, sizeof (lf));
  lf.lfHeight = 100;
  lf.lfWeight = FW_NORMAL;
  lf.lfItalic = FALSE;
  wcscpy(lf.lfFaceName, L"Arial");
  CFont fontSmall;
  fontSmall.CreatePointFontIndirect (&lf);

  // print heading with big font
  dc.SelectObject(&fontBig);
  dc.DrawText("Did you know...", &rectUp, DT_VCENTER|DT_SINGLELINE);

  // print text with small font
  dc.SelectObject(&fontSmall);
  dc.DrawText(m_strTipText, &rectDn, DT_WORDBREAK);
}
开发者ID:EgoIncarnate,项目名称:Serious-Engine,代码行数:65,代码来源:CtlTipOfTheDayText.cpp


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