⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graph_union.cpp

📁 VS2005 MFC 实现的画图程序
💻 CPP
字号:
#include"stdafx.h"
#include"GDraw.h"
#include"Graph_Union.h"



IMPLEMENT_SERIAL(Graph_Union,CObject,1)
void Graph_Union::operator =(Graph_Union &gu)
{
	type=gu.type ;
	count=gu.count ;
	color=gu.color ;
	fill_color=gu.fill_color;
	wide=gu.wide ;
	shape=gu.shape ;
	if(!pp)
		delete []pp;
	if(!count)
		pp=new CPoint[count];
	else
		pp=NULL;
	for(int i=0;i<gu.count ;i++)
		pp[i]=gu.pp [i];
		
}

Graph_Union::Graph_Union(const Graph_Union &gu) 
{
	type=gu.type ;
	count=gu.count ;
	color=gu.color ;
	fill_color=gu.fill_color ;
	wide=gu.wide ;
	shape=gu.shape ;
	if(count)
		pp=new CPoint[count];
	else
		pp=NULL;
	for(int i=0;i<gu.count ;i++)
		pp[i]=gu.pp [i];

}

Graph_Union::Graph_Union() 
{
	count=0;
	pp=NULL;
}
Graph_Union::Graph_Union(int t,int c,int w=1,int s=0,CPoint *ptr=NULL,COLORREF col=RGB(255,255,255),COLORREF f_col=RGB(0,0,0))
:type(t),count(c),wide(w),shape(s),color(col),fill_color(f_col)
{
	if(count)
	{
		pp=new CPoint [count];
		for(int i=0;i<count;i++)
			pp[i]=ptr[i];
	}
	else
		pp=NULL;

}
Graph_Union::~Graph_Union() 
{
	if(pp!=NULL)
		delete []pp;
}


void Graph_Union::Serialize(CArchive &ar)
{

/*	CObject::Serialize(ar);
	if(ar.IsStoring())
	{
    
		 ar<<type;   //the type of graphics:0 line; 1 circle; 2 ellipse; and so on;
		 ar<<count;   //the counter of points
		 ar<<color;
		 ar<<shape;
		 ar<<wide;
		 ar<<pp->x;
		 ar<<pp->y;
          
	}
	else
	{
	 ar>>type;   //the type of graphics:0 line; 1 circle; 2 ellipse; and so on;
	 ar>>count;   //the counter of points
     ar>>color;
	 ar>>shape;
	 ar>>wide;
	 ar>>pp->x;
	 ar>>pp->y;
	}
	*/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -