📄 manager_form.cpp
字号:
// manager_form.cpp : implementation file
//
#include "stdafx.h"
#include "LMTS.h"
#include "manager_form.h"
#include "teacher.h"
#include "change_pro.h"
#include "add_class.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// manager_form dialog
manager_form::manager_form(CWnd* pParent /*=NULL*/)
: CDialog(manager_form::IDD, pParent)
{
//{{AFX_DATA_INIT(manager_form)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
BOOL manager_form::OnInitDialog()
{
CDialog::OnInitDialog();
show_class.SetTextColor(RGB(100,0,100));
show_class.SetTextBkColor(RGB(240,247,233));
show_class.InsertColumn(1,"科目");
show_class.InsertColumn(0,"教师");
show_class.SetColumnWidth(0,170);
show_class.SetColumnWidth(1,200);
show_class.SetExtendedStyle(LVS_EX_FULLROWSELECT| LVS_EX_GRIDLINES);
teacher tea_db;
CString get_id,str;
//GetDlgItem(IDC_EDIT1)->GetWindowText(get_id);
str.Format("select * from teacher");// where name='%s'",get_id);
tea_db.Open(AFX_DB_USE_DEFAULT_TYPE,str);
int i=0;
while(!tea_db.IsEOF())
{
show_class.InsertItem(i,tea_db.m_course,0);
show_class.SetItemText(i,1,tea_db.m_name);
tea_db.MoveNext();
i++;
}
return TRUE;
}
void manager_form::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(manager_form)
DDX_Control(pDX, IDC_LIST1, show_class); // NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(manager_form, CDialog)
//{{AFX_MSG_MAP(manager_form)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// manager_form message handlers
void manager_form::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
void manager_form::OnButton1()
{
change_pro chg_pro;
CString id;
GetDlgItem(IDC_EDIT1)->GetWindowText(id);
chg_pro.id=id;
chg_pro.DoModal();
// TODO: Add your control notification handler code here
}
void manager_form::OnButton2()
{
add_class add_form;
add_form.DoModal();
// TODO: Add your control notification handler code here
}
void manager_form::OnButton3()
{
AfxEnableControlContainer();
/*
show_class.InsertColumn(0,"科目");
show_class.InsertColumn(1,"教师");
show_class.SetColumnWidth(0,170);
show_class.SetColumnWidth(1,200);
show_class.SetExtendedStyle(LVS_EX_FULLROWSELECT| LVS_EX_GRIDLINES);
//
*/
show_class.DeleteAllItems();
teacher tea_db;
CString get_id,str;
//tea_db.Close();
//GetDlgItem(IDC_EDIT1)->GetWindowText(get_id);
str.Format("select * from teacher");// where name='%s'",get_id);
tea_db.Open(AFX_DB_USE_DEFAULT_TYPE,str);
if(tea_db.GetRecordCount!=0){
int i=0;
tea_db.MoveFirst();
while(!tea_db.IsEOF())
{
show_class.InsertItem(i,tea_db.m_course,0);
show_class.SetItemText(i,1,tea_db.m_name);
tea_db.MoveNext();
i++;
}
}
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -