Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторная работа №13 / Laba1 / Laba1View
.cpp// Laba1View.cpp : implementation of the CLaba1View class
//
#include "stdafx.h"
#include "Laba1.h"
#include "Laba1Doc.h"
#include "Laba1View.h"
#include ".\laba1view.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CLaba1View
IMPLEMENT_DYNCREATE(CLaba1View, CView)
BEGIN_MESSAGE_MAP(CLaba1View, CView)
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
// CLaba1View construction/destruction
CLaba1View::CLaba1View()
: CentrX(0)
, CentrY(0)
{
// TODO: add construction code here
}
CLaba1View::~CLaba1View()
{
}
BOOL CLaba1View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
// CLaba1View drawing
void CLaba1View::OnDraw(CDC* pDC)
{
CLaba1Doc* pDoc = GetDocument();
CRect Rect;
CWnd* pWnd;
// COLORREF curColor = RGB(0, 0, 0);
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: add draw code for native data here
pWnd=pDC->GetWindow();
pWnd->GetClientRect(&Rect);
CentrX=(Rect.right + Rect.left)/2;
CentrY=(Rect.bottom + Rect.top)/2;
// curColor = RGB(0, 100, 0);
// pDC->SetDCPenColor(curColor);
pDC->MoveTo(CentrX, 0);
pDC->LineTo(CentrX, Rect.bottom);
pDC->MoveTo(0, CentrY);
pDC->LineTo(Rect.right, CentrY);
//Draw windov
// curColor = RGB(0, 0, 0);
// pDC->SetDCPenColor(curColor);
pDC->MoveTo(CentrX+theApp.Treug.GetX1(), CentrY-theApp.Treug.GetY1());
pDC->LineTo(CentrX+theApp.Treug.GetX2(), CentrY-theApp.Treug.GetY2());
pDC->LineTo(CentrX+theApp.Treug.GetX3(), CentrY-theApp.Treug.GetY3());
pDC->LineTo(CentrX+theApp.Treug.GetX1(), CentrY-theApp.Treug.GetY1());
}
// CLaba1View printing
BOOL CLaba1View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CLaba1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CLaba1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
// CLaba1View diagnostics
#ifdef _DEBUG
void CLaba1View::AssertValid() const
{
CView::AssertValid();
}
void CLaba1View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CLaba1Doc* CLaba1View::GetDocument() const // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLaba1Doc)));
return (CLaba1Doc*)m_pDocument;
}
#endif //_DEBUG
Соседние файлы в папке Laba1