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


C++ Graphics::DrawCurve方法代码示例

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


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

示例1: MyPaint_Mem


//.........这里部分代码省略.........

	CurePen = new Pen(Color(255,0,255,0));

	m_interval = (m_interval++)%5;	//让其向左平移;


	if(runonce < 2)				//初始化时画背景图案;
	{
		runonce ++;
		//Image myImage(L"texture.BMP");
		//TextureBrush myTextureBrush(&myImage);
		//RECT newrect_now;
		//GetWindowRect(myhWnd,&newrect_now);
		//mygraphics->FillRectangle(&myTextureBrush, 0, 0, newrect_now.right, newrect_now.bottom);


		SolidBrush  brush(Color(255, 0, 0, 255));
		FontFamily  fontFamily(_T("Times New Roman"));
		Gdiplus::Font        font(&fontFamily, 24, FontStyleRegular, UnitPixel);
		PointF      pointF(40.0f, 600.0f);
		for(int i=0;i<=20;i=i+2)				//增加文字 %;
		{
			pointF.Y = 600;
			pointF.Y = pointF.Y - i*30;
			wchar_t temp_char[200];
			//swprintf_s(temp_char,200,L"%d%%",i*5);
			swprintf_s(temp_char,200,L"%d",i*5);
			mygraphics->DrawString(temp_char, -1, &font, pointF, &brush);
		}
		pointF.X = 200;
		pointF.Y = 650;
		//mygraphics->DrawString(L"CPU 使用率", -1, &font, pointF, &brush);

	}


	//BlackBrush =new SolidBrush(Color(255,0,0,0));
	BlackBrush =new SolidBrush(Color(255,0,0,0));
	mygraphics->FillRectangle(BlackBrush,100,10,1200,600);
	mygraphics->DrawRectangle(myRectangle_pen,100,10,1200,600);



	for(int i=0;i<=39;i++)				//画网格线
		mygraphics->DrawLine(my_inline_pen,100+line_interval*(i+1)-m_interval*6,10,100+line_interval*(i+1)-m_interval*6,610);

	for(int i=0;i<19;i++)				//画网格线
		mygraphics->DrawLine(my_inline_pen,100,10+line_interval*(1+i),1300,10+line_interval*(1+i));
#if 0
	CPointItem *first_item=NULL,*second_item=NULL;
	first_item = m_pFirstItem;
	for (int i=0;i<Total_count-1;i++)
	{
		second_item=first_item->GetNext();
		if(second_item==NULL)
			break;
		//mygraphics->DrawCurve(CurePen,, 3, 1.5f);
		//Point myPointArray[] =
		//{Point(first_item->GetPoint().x,first_item->GetPoint().y),Point(second_item->GetPoint().x,second_item->GetPoint().y)};
		//mygraphics->DrawCurve(CurePen,myPointArray, 2, 1.0f);
		//mygraphics->DrawLine(CurePen,first_item->GetPoint().x,first_item->GetPoint().y,second_item->GetPoint().x,second_item->GetPoint().y);
		first_item = second_item;
	}
#endif
#if 1
	CPointItem *first_item=NULL,*second_item=NULL,*third_item=NULL;
	first_item = m_pFirstItem;

	for (int i=0;i<Total_count-1;i=i+2)	//画贝塞尔曲线,使得线条平滑;3个点一画;
	{
		second_item=first_item->GetNext();
		third_item = second_item->GetNext();
		if(second_item==NULL)
			break;
		if(third_item == NULL)
		{
			first_item = second_item;
			break;
		}
		//mygraphics->DrawCurve(CurePen,, 3, 1.5f);
		//取3个点给画曲线的GDI函数;
		Point myPointArray[] =
		{Point(first_item->GetPoint().x,first_item->GetPoint().y),
		Point(second_item->GetPoint().x,second_item->GetPoint().y),
		Point(third_item->GetPoint().x,third_item->GetPoint().y)};
		mygraphics->DrawCurve(CurePen,myPointArray, 3, 1.0f);
		//mygraphics->DrawLine(CurePen,first_item->GetPoint().x,first_item->GetPoint().y,second_item->GetPoint().x,second_item->GetPoint().y);

		first_item = third_item;
	}
#endif
	//	mygraphics->DrawLine(CurePen,)


	delete CurePen;
	delete mygraphics;
	delete myRectangle_pen;
	delete my_inline_pen;
	delete BlackBrush;
}
开发者ID:jay-github,项目名称:T3000_Building_Automation_System,代码行数:101,代码来源:BacnetGraphic.cpp


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