Ado 实现C 对象的存取.docx
《Ado 实现C 对象的存取.docx》由会员分享,可在线阅读,更多相关《Ado 实现C 对象的存取.docx(13页珍藏版)》请在优知文库上搜索。
1、AdO实现C对象的存取Ado现实现C+对象的存取作者:江上飞鸟下载源代码其实我最厌烦写东西了,最近忙死了,呵呵,前一段时间在做一个图形程序时,须要把C+对象保存到数据库里,刚起先真让我头疼啊,琢磨了个下午,最终给做出来了,废话不说了,还是把自己的一些体会与各位同任一起共享!”!-、新建一个继承于CObjeCt的子类C1.ine;头文件:1.ine.hclassC1.ine:ublicCObject?private:1.OGPENm_IogPen;画笔C01.0RKEFm_crBackColor;CArrayCPoint,CPointmPointArray;标记类对应框ublic:intGetS
2、izeO;CPointGetPoint(intpos);voidDraw1.ine(CDC*DC,CPointptl,CPointpt2,CRectrc);voidDrawBackGround(CDC*pDC,CRectrect);voidDrawPoint(CDC*pDC,CRectrect):voidSetWidth(intiWidth);CO1.ORREFGetColorO;voidSetColor(CO1.ORREFcolor);CO1.ORREFGetBkColorO;voidSetBkColor(CO1.ORREFcolor);voidAddPoint(CPointpoint);v
3、oidClearO;C1.ineO;virtualC1.ine();virtualvoidSerialize(CArchivear);C1.ineoperator=(C1.inesrc):DEC1.ARE.SERlA1.(C1.ine)?);实现文件:1.ine,cpp/1.ine,cpp:implementationoftheC1.ineclass./IlizilllllllllllllllillllllllllllllllllllllHlllllllIIIIII/Sincludestdafx.hincludeTestAdo.hinclude1.ine.httifdef_DEBUG#Unde
4、fTHIS_FI1.EstaticcharTHIS_FI1.E=_FI1.E_:definenewDEBuG_NEW8endifIMP1.EMENT_SERIAI/C1.ine,CObject,1)C1.ine:C1.ine()ClearO;C1.ine:C1.ineO重写=C1.ineC1.ine:operator=(C1.inesrc)if(this!=src)m_IogPen=src.m_logPen;m_crBackColor=src.ra_crBackColor:return*this;?串行化操作voidC1.ine:Serialize(CArchivear)if(ar.IsSto
5、ringO)arDWORD(m_crBackColor);ar.Write(m_logPcn,Sizeof(1.OGPEN);elseDWORDdw;ardw;m_crBackColor=CO1.ORREF(dw);ar.Read(m_IogPen,Sizeof(1.OGPEN);m_PointArray.Serialize(ar);voidC1.inenClearO(m_crBackColor=RGB(255,255,255):m_IogPen.IopnStyle=PS_SO1.ID;m_logPcn.IopnWidth.x=1;m_IogPen.IopnWidth.y=1:m_IogPen
6、.IopnColor=RGB(O,O,O);m_PointArray.ReinoveAl1();voidC1.ine:AddPoint(CPointpoint)m_Pointrray.Add(point);voidC1.ine:SetColor(CO1.ORREFcolor)m_logPen.IopnColor=color;CO1.ORREFC1.ine:GetColorOreturnm_IogPen.IopnColor;voidC1.ine:SetBkColor(CO1.ORREFcolor)m_crBackColor=color:CO1.ORREFC1.ine:IGetBkColorOre
7、turnm_crBackColor;)voidC1.ine:SetWidth(intiWidth)m_logPcn.IopnWidth.x=iWidth;m_logPen.IopnWidth.y=iWidth;绘线条VoidC1.ine:DrawPoint(CF)C*p)C,CRectred)(intIen=m-Pointrray.GetSizeO;if(len=0)return:CPenpen;pen.CreatePenIndirect(m_logPen):CPen*pIdPenPDC-SelectObject(pen):CPointpt=m-Pointrray.Gett(O):pX-Mov
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Ado 实现C 对象的存取 实现 对象 存取