?? cbubblelvhongview.cpp
字號:
// CBubbleLvhongView.cpp : implementation of the CCBubbleLvhongView class
//
#include "stdafx.h"
#include "CBubbleLvhong.h"
#include "CBubbleLvhongDoc.h"
#include "CBubbleLvhongView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCBubbleLvhongView
IMPLEMENT_DYNCREATE(CCBubbleLvhongView, CView)
BEGIN_MESSAGE_MAP(CCBubbleLvhongView, CView)
//{{AFX_MSG_MAP(CCBubbleLvhongView)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
// 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()
/////////////////////////////////////////////////////////////////////////////
// CCBubbleLvhongView construction/destruction
CCBubbleLvhongView::CCBubbleLvhongView()
{
// TODO: add construction code here
}
CCBubbleLvhongView::~CCBubbleLvhongView()
{
}
BOOL CCBubbleLvhongView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCBubbleLvhongView drawing
void CCBubbleLvhongView::OnDraw(CDC* pDC)
{
CCBubbleLvhongDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
//pDC->SelectStockObject(LTGRAY_BRUSH);
//CPen NewPen ,*OldPen;
//NewPen.CreatePen(PS_DASHDOTDOT,3,RGB(0,255,255));
//OldPen=pDC->SelectObject(&NewPen);
CBrush br(HS_DIAGCROSS ,RGB(255,255,0));
CBrush *pbrOld=pDC->SelectObject(&br);
for(int i=0;i<pDoc->GetListSize();i++)
{
pDC->Ellipse(pDoc->GetBubble(i));
}
pDC->SelectObject(pbrOld);
}
/////////////////////////////////////////////////////////////////////////////
// CCBubbleLvhongView printing
BOOL CCBubbleLvhongView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CCBubbleLvhongView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CCBubbleLvhongView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CCBubbleLvhongView diagnostics
#ifdef _DEBUG
void CCBubbleLvhongView::AssertValid() const
{
CView::AssertValid();
}
void CCBubbleLvhongView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCBubbleLvhongDoc* CCBubbleLvhongView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCBubbleLvhongDoc)));
return (CCBubbleLvhongDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCBubbleLvhongView message handlers
void CCBubbleLvhongView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CCBubbleLvhongDoc* pDoc=GetDocument();//得到文檔的一個指針
ASSERT_VALID(pDoc);
int r=rand()%50+5;//生成泡泡
CRect rectBubble(point.x-r,point.y-r,point.x+r,point.y+r);
pDoc->AddBubble(rectBubble);
pDoc->SetModifiedFlag();
InvalidateRect(rectBubble,FALSE);
CView::OnLButtonDown(nFlags, point);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -