📄 queryframe.cpp
字号:
// QueryFrame.cpp : implementation file
//
#include "stdafx.h"
#include "indent.h"
#include "QueryFrame.h"
#include "QueryView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// QueryFrame
IMPLEMENT_DYNCREATE(QueryFrame, CMDIChildWnd)
QueryFrame::QueryFrame()
{
m_bDateTimeChange = FALSE;
}
QueryFrame::~QueryFrame()
{
}
BEGIN_MESSAGE_MAP(QueryFrame, CMDIChildWnd)
ON_WM_CREATE()
ON_COMMAND_EX(CG_QUERY_DIALOGBAR, OnBarCheck)
ON_UPDATE_COMMAND_UI(CG_QUERY_DIALOGBAR, OnUpdateControlBarMenu)
//{{AFX_MSG_MAP(QueryFrame)
ON_BN_CLICKED(IDC_BTN_QUERY, OnBtnQuery)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// QueryFrame message handlers
int QueryFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add a menu item that will toggle the visibility of the // dialog bar named "My Dialog Bar": // 1. In ResourceView, open the menu resource that is used by // the QueryFrame class // 2. Select the View submenu // 3. Double-click on the blank item at the bottom of the submenu // 4. Assign the new item an ID: CG_ID_VIEW_MYDIALOGBAR // 5. Assign the item a Caption: My Dialog Bar // TODO: Change the value of CG_ID_VIEW_MYDIALOGBAR to an appropriate value: // 1. Open the file resource.h // CG: The following block was inserted by the 'Dialog Bar' component { // Initialize dialog bar m_wndMyDialogBar if (!m_wndMyDialogBar.Create(this, CG_QUERY_DIALOGBAR, CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE, CG_QUERY_DIALOGBAR)) { TRACE0("Failed to create dialog bar m_wndMyDialogBar\n"); return -1; // fail to create } m_wndMyDialogBar.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM); EnableDocking(CBRS_ALIGN_ANY);// DockControlBar(&m_wndMyDialogBar); } return 0;
}
void QueryFrame::ActivateFrame(int nCmdShow)
{
// TODO: Add your specialized code here and/or call the base class
nCmdShow = SW_SHOWMAXIMIZED;
CMDIChildWnd::ActivateFrame(nCmdShow);
}
void QueryFrame::OnGetDateTime()
{
// 设置查询对话框的时间
CTime tm;
((CDateTimeCtrl*)m_wndMyDialogBar.GetDlgItem(IDC_DATETIMEPICKER1))->GetTime(tm);
((CDateTimeCtrl*)m_wndMyDialogBar.GetDlgItem(IDC_DATETIMEPICKER1))->SetTime(&CTime(tm.GetYear(),
tm.GetMonth()-1,1, tm.GetHour(),tm.GetSecond(), 0));
QueryView* pQueryView = (QueryView*)GetActiveView();
m_wndMyDialogBar.GetDlgItemText(IDC_DATETIMEPICKER1,pQueryView->m_strBeginTime);
m_wndMyDialogBar.GetDlgItemText(IDC_DATETIMEPICKER2,pQueryView->m_strEndTime);
}
void QueryFrame::OnBtnQuery()
{
//将时间典赋值给查询对话框控件
QueryView* pQueryView = (QueryView*)GetActiveView();
m_wndMyDialogBar.GetDlgItemText(IDC_DATETIMEPICKER1,pQueryView->m_strBeginTime);
m_wndMyDialogBar.GetDlgItemText(IDC_DATETIMEPICKER2,pQueryView->m_strEndTime);
pQueryView->Query();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -