📄 leftpaneview.cpp
字号:
// LeftPaneView.cpp : implementation file
//
#include "stdafx.h"
#include "PropertyManager.h"
#include "LeftPaneView.h"
#include "RightPaneFrame.h"
#include "LogonDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLeftPaneView
extern CPropertyManagerApp theApp;
IMPLEMENT_DYNCREATE(CLeftPaneView, CFormView)
CLeftPaneView::CLeftPaneView()
: CFormView(CLeftPaneView::IDD)
{
//{{AFX_DATA_INIT(CLeftPaneView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_showmsg_flag = false;
m_printview_flag = false;
}
CLeftPaneView::~CLeftPaneView()
{
}
void CLeftPaneView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLeftPaneView)
DDX_Control(pDX, IDC_TREE, m_treeCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLeftPaneView, CFormView)
//{{AFX_MSG_MAP(CLeftPaneView)
ON_WM_SIZE()
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE, OnSelchangedTree)
ON_WM_TIMER()
ON_COMMAND(ID_SHOW_MSG, OnShowMsg)
ON_UPDATE_COMMAND_UI(ID_SHOW_MSG, OnUpdateShowMsg)
ON_COMMAND(ID_MENU_CONECT, OnMenuConect)
ON_COMMAND(ID_MENU_LOGOUT, OnMenuLogout)
ON_COMMAND(ID_MENU_LOCK, OnMenuLock)
ON_COMMAND(ID_MENU_PRINTVIEW, OnMenuPrintview)
ON_UPDATE_COMMAND_UI(ID_MENU_PRINTVIEW, OnUpdateMenuPrintview)
ON_COMMAND(ID_MENU_PRINT, OnMenuPrint)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLeftPaneView diagnostics
#ifdef _DEBUG
void CLeftPaneView::AssertValid() const
{
CFormView::AssertValid();
}
void CLeftPaneView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CLeftPaneView message handlers
void CLeftPaneView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_pRightPaneFrame->SwitchToView(VIEW_LISTCTRL);
m_treeCtrl.SetBkColor(RGB(240,247,233));//设置背景
m_ImageList.Create(IDB_IMAGES, 16, 1, RGB(255, 0, 255));
m_treeCtrl.SetImageList(&m_ImageList, LVSIL_NORMAL);
SetTimer(1,50,NULL);
/* m_hSplitterView = m_treeCtrl.InsertItem("Splitter View", 0, 0);
m_hListCtrlView = m_treeCtrl.InsertItem("ListCtrl View", 1, 1);
m_hEditView = m_treeCtrl.InsertItem("EditCtrl View", 2, 2);
*/
}
void CLeftPaneView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if (GetSafeHwnd())
{
CRect rect;
GetClientRect(&rect);
if (m_treeCtrl.GetSafeHwnd())
m_treeCtrl.MoveWindow(&rect);
}
}
void CLeftPaneView::OnSelchangedTree(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
HTREEITEM hSelectedItem = m_treeCtrl.GetSelectedItem();
/* UINT nView = 0;
if (hSelectedItem == m_hSplitterView)
nView = VIEW_SPLITTER;
else
if (hSelectedItem == m_hListCtrlView)
nView = VIEW_LISTCTRL;
else
if (hSelectedItem == m_hEditView)
nView = VIEW_EDIT;
if (nView) m_pRightPaneFrame->SwitchToView(nView);
*/ *pResult = 0;
}
void CLeftPaneView::OnCancel()
{
// TODO: Add your control notification handler code here
}
void CLeftPaneView::OnOK()
{
// TODO: Add your control notification handler code here
}
void CLeftPaneView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent == 1)
{
KillTimer(1);
if(theApp.ConnectAccess()==TRUE)
OnMenuConect();
else
AfxMessageBox("ERROR");
}
CFormView::OnTimer(nIDEvent);
}
void CLeftPaneView::OnShowMsg()
{
// TODO: Add your command handler code here
m_showmsg_flag = !m_showmsg_flag;
if(m_showmsg_flag)
{
m_pRightPaneFrame->SwitchToView(VIEW_SPLITTER);
m_printview_flag = false;
}
else
{
m_pRightPaneFrame->SwitchToView(VIEW_LISTCTRL);
}
}
void CLeftPaneView::OnUpdateShowMsg(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_showmsg_flag);
}
void CLeftPaneView::OnMenuConect()
{
// TODO: Add your command handler code here
CLogonDialog m_dlg;
m_dlg.DoModal();
}
void CLeftPaneView::OnMenuLogout()
{
// TODO: Add your command handler code here
if(AfxMessageBox("真的要注销此用户吗?",MB_YESNO)==IDNO)
return;
theApp.m_userinfo.user ="";
theApp.m_userinfo.time =0;
OnMenuConect();
}
#include "LockUser.h"
void CLeftPaneView::OnMenuLock()
{
// TODO: Add your command handler code here
CLockUser m_dlg;
m_dlg.m_user = theApp.m_userinfo.user;
m_dlg.m_pwd = "";
m_dlg.oldpwd = theApp.m_userinfo.pwd;
m_dlg.DoModal();
}
void CLeftPaneView::OnMenuPrintview()
{
// TODO: Add your command handler code here
m_printview_flag = !m_printview_flag;
if(m_printview_flag )
{
m_pRightPaneFrame->SwitchToView(VIEW_EDIT);
m_showmsg_flag = false;
}
else
m_pRightPaneFrame->SwitchToView(VIEW_LISTCTRL);
}
void CLeftPaneView::OnUpdateMenuPrintview(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_printview_flag);
}
void CLeftPaneView::OnMenuPrint()
{
// TODO: Add your command handler code here
m_pRightPaneFrame->m_pEditCtrlView->PrintHtmlText();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -