// noteView.cpp : implementation of the CNoteView class // #include "stdafx.h" #include "note.h" #include "noteDoc.h" #include "noteView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CNoteView IMPLEMENT_DYNCREATE(CNoteView, CView) BEGIN_MESSAGE_MAP(CNoteView, CView) //{{AFX_MSG_MAP(CNoteView) ON_COMMAND(ID_STICKNOTE_SHOW, OnStickyNoteShow) //}}AFX_MSG_MAP // Standard printing commands END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CNoteView construction/destruction CNoteView::CNoteView() { } CNoteView::~CNoteView() { for(int i=0; iIsKindOf(RUNTIME_CLASS(CNoteDoc))); return (CNoteDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CNoteView message handlers void CNoteView::OnStickyNoteShow() { CNoteWnd* pNoteWnd=new CNoteWnd(this); CRect rect; pNoteWnd->GetWindowRect(&rect); int nXScreen=::GetSystemMetrics(SM_CXSCREEN); int nYScreen=::GetSystemMetrics(SM_CYSCREEN); nXScreen-=rect.Width(); nYScreen-=rect.Height(); srand((unsigned)time(NULL)); CPoint point; point.x=rand()*3%nXScreen; point.y=rand()*2%nYScreen; pNoteWnd->SetWindowPos(NULL,point.x,point.y,0,0,SWP_NOZORDER|SWP_NOSIZE); m_arrNoteWnd.Add(pNoteWnd); }