开发工具:
文件大小: 8mb
下载次数: 0
上传时间: 2012-12-13
详细说明: 较为完整的vc++ 画图程序 IMPLEMENT_SERIAL(CShape,CObject,1) IMPLEMENT_SERIAL(CLine,CShape,1) IMPLEMENT_SERIAL(CRectangle,CShape,1) IMPLEMENT_SERIAL(CCircle,CShape,1) IMPLEMENT_SERIAL(CCurve,CShape,1) IMPLEMENT_SERIAL(CEllipse,CShape,1) CShape::CShape(void) { } CShape::~CShape(void) { } CRect CShape::GetBoundRect() { CRect BoundingRect; // Object to store bounding rectangle BoundingRect = m_EnclosingRect; // Store the enclosing rectangle // Increase the rectangle by the pen width BoundingRect.InflateR ect(m_Pen, m_Pen); return BoundingRect; // Return the bounding rectangle } void CShape::Serialize(CArchive& ar) { CObject::Serialize(ar); if(ar.IsStoring()) { ar<>m_Color>>m_Brush>>m_EnclosingRect>>m_Pen; } } CLine::CLine(void) { } CLine::~CLine(void) { } // CLine class constructor CLine::CLine(CPoint Start, CPoint End, COLORREF aColor,int PenWidth) { m_StartPoint = Start; // Set line start point m_EndPoint = End; // Set line end point m_Color = aColor; //m_Brush=aBrush;// Set line color m_Pen = PenWidth; // Set pen width // Define the enclosing rectangle m_EnclosingRect = CRect(Start, End); m_EnclosingRect.NormalizeRect(); } // Draw a CLine object void CLine::Draw(CDC* pDC) { // Create a pen for this object and // initialize it to the object color and line width of 1 pixel CPen aPen; if(!aPen.CreatePen(PS_SOLID, m_Pen, m_Color)) { // Pen creation failed. Abort the program AfxMessageBox(_T("Pen creation failed drawing a line"), MB_OK); AfxAbort(); } CPen* pOldPen = pDC->SelectObject(&aPen;); // Select the pen // Now draw the line pDC->MoveTo(m_StartPoint); pDC->LineTo(m_EndPoint); pDC->SelectObject(pOldPen); // Restore the old pen } void CLine::Serialize(CArchive& ar) { CShape::Serialize(ar); if(ar.IsStoring()) { ar<>m_StartPoint>>m_EndPoint; } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.