📄 branchmanagerview.cpp
字号:
// BranchManagerView.cpp : implementation of the CBranchManagerView class
//
#include "stdafx.h"
#include "BranchManager.h"
#include "BranchManagerSet.h"
#include "BranchManagerDoc.h"
#include "BranchManagerView.h"
#include "TrayIcon.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define WM_TRAYNOTIFY WM_USER+100
/////////////////////////////////////////////////////////////////////////////
// CBranchManagerView
IMPLEMENT_DYNCREATE(CBranchManagerView, CDaoRecordView)
BEGIN_MESSAGE_MAP(CBranchManagerView, CDaoRecordView)
//{{AFX_MSG_MAP(CBranchManagerView)
ON_WM_RBUTTONDOWN()
ON_WM_CREATE()
ON_COMMAND(ID_SHOWMAIN, OnShowmain)
ON_COMMAND(ID_CLOSEMAIN, OnClosemain)
ON_COMMAND(ID_HIDEMAIN, OnHidemain)
ON_MESSAGE(WM_TRAYNOTIFY,OnTrayNotification)
ON_WM_TIMER()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CDaoRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CDaoRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CDaoRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBranchManagerView construction/destruction
CBranchManagerView::CBranchManagerView()
: CDaoRecordView(CBranchManagerView::IDD)
{
//{{AFX_DATA_INIT(CBranchManagerView)
// NOTE: the ClassWizard will add member initialization here
m_pSet = NULL;
m_bShow=FALSE;
//}}AFX_DATA_INIT
// TODO: add construction code here
}
CBranchManagerView::~CBranchManagerView()
{
}
void CBranchManagerView::DoDataExchange(CDataExchange* pDX)
{
CDaoRecordView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBranchManagerView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BOOL CBranchManagerView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CDaoRecordView::PreCreateWindow(cs);
}
void CBranchManagerView::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_branchManagerSet;
CDaoRecordView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
}
/////////////////////////////////////////////////////////////////////////////
// CBranchManagerView printing
BOOL CBranchManagerView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CBranchManagerView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CBranchManagerView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CBranchManagerView diagnostics
#ifdef _DEBUG
void CBranchManagerView::AssertValid() const
{
CDaoRecordView::AssertValid();
}
void CBranchManagerView::Dump(CDumpContext& dc) const
{
CDaoRecordView::Dump(dc);
}
CBranchManagerDoc* CBranchManagerView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBranchManagerDoc)));
return (CBranchManagerDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CBranchManagerView database support
CDaoRecordset* CBranchManagerView::OnGetRecordset()
{
return m_pSet;
}
void CBranchManagerView::OnRButtonDown(UINT nFlags, CPoint point)
{
//CMenu ContextMenu;
//ContextMenu.LoadMenu(IDR_MENU1);
//ClientToScreen(&point);
//(ContextMenu.GetSubMenu(0))->TrackPopupMenu(TPM_LEFTALIGN,
// point.x,point.y,AfxGetMainWnd(),0);
//CDaoRecordView::OnRButtonDown(nFlags, point);
}
int CBranchManagerView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDaoRecordView::OnCreate(lpCreateStruct) == -1)
return -1;
HICON hIcon;
hIcon=AfxGetApp()->LoadIcon(IDI_ARROW11);
m_TrayIcon.Create(this,WM_TRAYNOTIFY,"网点管理",hIcon,IDR_MENU2);
m_bShow=TRUE;
i=0;
this->SetTimer(1,150,NULL);
return 0;
}
LRESULT CBranchManagerView::OnTrayNotification(WPARAM wParam, LPARAM lParam)
{
return m_TrayIcon.OnTrayNotification(wParam,lParam);
}
void CBranchManagerView::OnShowmain()
{
if(!m_bShow)
{
CWnd* pWnd;
pWnd=AfxGetApp()->m_pMainWnd;
pWnd->ShowWindow(SW_SHOW);
m_bShow=TRUE;
}
}
void CBranchManagerView::OnClosemain()
{
// TODO: Add your command handler code here
CWnd* pWnd;
pWnd=AfxGetApp()->m_pMainWnd;
pWnd->SendMessage(WM_CLOSE);
}
void CBranchManagerView::OnHidemain()
{
if(m_bShow)
{
CWnd* pWnd;
pWnd=AfxGetApp()->m_pMainWnd;
pWnd->ShowWindow(SW_HIDE);
m_bShow=FALSE;
}
}
void CBranchManagerView::OnTimer(UINT nIDEvent)
{
switch (i)
{
case 0:
m_TrayIcon.ModifyIcon(AfxGetApp()->LoadIcon(IDI_ARROW44));
i++;
break;
case 1:
m_TrayIcon.ModifyIcon(AfxGetApp()->LoadIcon(IDI_ARROW33));
i++;
break;
case 2:
m_TrayIcon.ModifyIcon(AfxGetApp()->LoadIcon(IDI_ARROW22));
i++;
break;
case 3:
m_TrayIcon.ModifyIcon(AfxGetApp()->LoadIcon(IDI_ARROW11));
i=0;
break;
}
CDaoRecordView::OnTimer(nIDEvent);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -