简易画图板

时间:2016-01-03 14:55:12
【文件属性】:

文件名称:简易画图板

文件大小:8.23MB

文件格式:RAR

更新时间:2016-01-03 14:55:12

画图 直线 曲线

较为完整的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.InflateRect(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; } }


【文件预览】:
TestPalette
----TestPalette()
--------stdafx.cpp(142B)
--------TestPalette.cpp(3KB)
--------TestPalette1(2KB)
--------res()
--------stdafx.h(2KB)
--------Shape.h(4KB)
--------TestPaletteDoc.cpp(7KB)
--------TestPalette.vcproj.sunday-PC.sunday.user(1KB)
--------TestPaletteView.cpp(6KB)
--------TestPaletteDoc.h(2KB)
--------TestPalette.aps(72KB)
--------TestPaletteView.h(1KB)
--------ChildFrm.cpp(891B)
--------Shape.cpp(11KB)
--------TestPalette.h(501B)
--------PenDialog.cpp(2KB)
--------TestPalette.vcproj.G09.cnu.user(1KB)
--------MainFrm.cpp(2KB)
--------resource.h(2KB)
--------MainFrm.h(756B)
--------PenDialog.h(675B)
--------ChildFrm.h(483B)
--------Debug()
--------TestPalette.rc(15KB)
--------ReadMe.txt(4KB)
--------TestPalette.vcproj(6KB)
----TestPalette.sln(898B)
----debug()
--------TestPalette.pdb(3.64MB)
--------TestPalette.exe(196KB)
--------TestPalette.ilk(2.02MB)
----TestPalette.suo(77KB)
----TestPalette.ncb(14.1MB)

网友评论