📄 wxcxdlg.cpp
字号:
// Wxcxdlg.cpp : implementation file
//
#include "stdafx.h"
#include "HKGL.h"
#include "Wxcxdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWxcxdlg dialog
CWxcxdlg::CWxcxdlg(CWnd* pParent /*=NULL*/)
: CDialog(CWxcxdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CWxcxdlg)
m_find = _T("");
//}}AFX_DATA_INIT
}
void CWxcxdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWxcxdlg)
DDX_Control(pDX, IDC_LIST1, m_wxList);
DDX_Control(pDX, IDC_COMBO2, m_wxcom2);
DDX_Control(pDX, IDC_COMBO1, m_wxcom);
DDX_Text(pDX, IDC_EDIT1, m_find);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CWxcxdlg, CDialog)
//{{AFX_MSG_MAP(CWxcxdlg)
ON_BN_CLICKED(IDC_BUTTON1, OnFINDWX)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWxcxdlg message handlers
void CWxcxdlg::OnFINDWX()
{
UpdateData(TRUE);
m_wxcom.GetLBText(m_wxcom.GetCurSel(),m_comstr1);
m_wxcom2.GetLBText(m_wxcom2.GetCurSel(),m_comstr2);
if(m_wx.IsOpen())
m_wx.Close();
m_wx.Open();
if(m_comstr1=="日期查询")
{
m_wx.m_strFilter.Format("[维修时间]='"+m_comstr2+"'");
m_wxList.DeleteAllItems();
}
else if(m_comstr1=="编号查询")
{
m_wx.m_strFilter.Format("[航班编号] LIKE '%%"+m_find+"%%'");
m_wxList.DeleteAllItems();
}
else if(m_comstr1=="维修状况")
{
m_wx.m_strFilter.Format("[维修情况] LIKE '%%"+m_find+"%%'");
m_wxList.DeleteAllItems();
}
m_wx.Requery();
if(m_wx.IsEOF())
{
m_wx.Close();
AfxMessageBox("没有该时间航班!");
return ;
}
else
this->Show();
}
BOOL CWxcxdlg::OnInitDialog()
{
CDialog::OnInitDialog();
CWX_Recordset m_wx(&theApp.m_DB );
m_wxcom.SetCurSel(0);
m_wxcom2.SetCurSel(0);
m_wxList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
unsigned i=0;
CODBCFieldInfo Info;
m_wx.Open();
for(i=0;i<m_wx.m_nFields;i++)
{
m_wx.GetODBCFieldInfo(i,Info);
m_wxList.InsertColumn(i,Info.m_strName ,LVCFMT_LEFT,100);
}
m_wx.Close();
m_Fwx=TRUE;
this->Show();
m_Fwx=FALSE;
SetTimer(1,2,NULL);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
int CWxcxdlg::Show()
{
int i=0;
if(m_Fwx==TRUE)
m_wx.Open();
m_wx.MoveFirst();
do
{
m_wxList.InsertItem(i,m_wx.m_column1 );
m_wxList.SetItemText(i,1,m_wx.m_column2);
m_wxList.SetItemText(i,2,m_wx.m_column3);
m_wxList.SetItemText(i,3,m_wx.m_column4);
m_wxList.SetItemText(i,4,m_wx.m_column5);
m_wxList.SetItemText(i,5,m_wx.m_column6);
m_wx.MoveNext();
i++;
}while(!m_wx.IsEOF());
m_wx.Close();
m_wxCount=i;
return i;
}
void CWxcxdlg::OnTimer(UINT nIDEvent)
{
CString str;
m_wxcom.GetLBText(m_wxcom.GetCurSel(),str);
if(str=="日期查询")
{
GetDlgItem(IDC_EDIT1)->EnableWindow(FALSE);
m_wxcom2.EnableWindow(TRUE);
}
else
{
GetDlgItem(IDC_EDIT1)->EnableWindow(TRUE);
m_wxcom2.EnableWindow(FALSE);
}
CDialog::OnTimer(nIDEvent);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -