www.gusucode.com > 一个与窗体框架、图标、光标、工具栏相关的VC++程序源码程 > 一个与窗体框架、图标、光标、工具栏相关的VC++程序源码程序/code/StyleView.cpp
// StyleView.cpp : implementation of the CStyleView class // Download by http://www.NewXing.com #include "stdafx.h" #include "Style.h" #include "StyleDoc.h" #include "StyleView.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CStyleView IMPLEMENT_DYNCREATE(CStyleView, CView) BEGIN_MESSAGE_MAP(CStyleView, CView) //{{AFX_MSG_MAP(CStyleView) ON_WM_CREATE() ON_WM_MOUSEMOVE() //}}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() ///////////////////////////////////////////////////////////////////////////// // CStyleView construction/destruction CStyleView::CStyleView() { // TODO: add construction code here } CStyleView::~CStyleView() { } BOOL CStyleView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs //cs.lpszClass="sunxin.org"; //cs.lpszClass=AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, // LoadCursor(NULL,IDC_CROSS),(HBRUSH)GetStockObject(BLACK_BRUSH),0); //cs.lpszClass=AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW); return CView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CStyleView drawing void CStyleView::OnDraw(CDC* pDC) { CStyleDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here } ///////////////////////////////////////////////////////////////////////////// // CStyleView printing BOOL CStyleView::OnPreparePrinting(CPrintInfo* pInfo) { // default preparation return DoPreparePrinting(pInfo); } void CStyleView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add extra initialization before printing } void CStyleView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add cleanup after printing } ///////////////////////////////////////////////////////////////////////////// // CStyleView diagnostics #ifdef _DEBUG void CStyleView::AssertValid() const { CView::AssertValid(); } void CStyleView::Dump(CDumpContext& dc) const { CView::Dump(dc); } CStyleDoc* CStyleView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CStyleDoc))); return (CStyleDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CStyleView message handlers int CStyleView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here // SetClassLong(m_hWnd,GCL_HBRBACKGROUND,(LONG)GetStockObject(BLACK_BRUSH)); // SetClassLong(m_hWnd,GCL_HCURSOR,(LONG)LoadCursor(NULL,IDC_HELP)); return 0; } void CStyleView::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CString str; str.Format("x=%d,y=%d",point.x,point.y); //((CMainFrame*)GetParent())->m_wndStatusBar.SetWindowText(str); //((CMainFrame*)GetParent())->SetMessageText(str); //((CMainFrame*)GetParent())->GetMessageBar()->SetWindowText(str); GetParent()->GetDescendantWindow(AFX_IDW_STATUS_BAR)->SetWindowText(str); CView::OnMouseMove(nFlags, point); }