📄 影院售票dlg.cpp
字号:
// 影院售票Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "影院售票.h"
#include "影院售票Dlg.h"
#include "ADOConn.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg dialog
CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyDlg::IDD, pParent)
{
s_day=0;
s_mouth=0;
s_film="";
s_num=0;
price=88;
//{{AFX_DATA_INIT(CMyDlg)
m_Name = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyDlg)
DDX_Control(pDX, IDC_IMAGE2, m_image2);
DDX_Control(pDX, IDC_IMAGE1, m_image1);
DDX_Control(pDX, IDC_MOUTH_COMBO, m_mouth);
DDX_Control(pDX, IDC_DAY_COMBO, m_day);
DDX_Control(pDX, IDC_IMAGE, m_image);
DDX_Text(pDX, IDC_EDIT_NAME, m_Name);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
//{{AFX_MSG_MAP(CMyDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_SELL_BUTTON, OnSellButton)
ON_EN_CHANGE(IDC_EDIT_NAME, OnChangeEditName)
ON_BN_CLICKED(IDC_HEJI_BUTTON, OnHejiButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg message handlers
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_day.AddString("1");
m_day.AddString("2");
m_day.AddString("3");
m_day.AddString("4");
m_day.AddString("5");
m_day.AddString("6");
m_day.AddString("7");
m_day.AddString("8");
m_day.AddString("9");
m_day.AddString("10");
m_day.AddString("11");
m_day.AddString("12");
m_day.AddString("13");
m_day.AddString("14");
m_day.AddString("15");
m_day.AddString("16");
m_day.AddString("17");
m_day.AddString("18");
m_day.AddString("19");
m_day.AddString("20");
m_day.AddString("21");
m_day.AddString("22");
m_day.AddString("23");
m_day.AddString("24");
m_day.AddString("25");
m_day.AddString("26");
m_day.AddString("27");
m_day.AddString("28");
m_day.AddString("29");
m_day.AddString("30");
m_day.AddString("31");
m_mouth.AddString("8");
m_mouth.AddString("11");
m_mouth.AddString("13");
m_mouth.AddString("16");
m_mouth.AddString("20");
m_mouth.AddString("22");
return TRUE; // return TRUE unless you set the focus to a control
}
void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMyDlg::OnPaint()
{
CDC* pDC ;
CRect m_rect;
m_image.GetClientRect(m_rect);
pDC=m_image.GetDC();
CFont m_font;
pDC->SetBkMode(TRANSPARENT);
GetClientRect(m_rect);
//pDC->FillRect(m_rect,NULL);
//pDC->SetViewportOrg(m_rect.Width()/2,m_rect.Height()/2);
m_font.CreateFont(-14,-10,10,0,600,0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_ROMAN,"宋体");
pDC->SelectObject(&m_font);
pDC->SetTextColor(RGB(255,50,18));
CString ss_day,ss_mouth,ss_film;
ss_day.Format("%d",s_day);
ss_mouth.Format("%d",s_mouth);
ss_film.Format("%d",s_film);
CString date="";
CString sd_num;
CString sd_day;
CString sd_mouth;
sd_day.Format("%d",s_day);
sd_mouth.Format("%d",s_mouth);
sd_num.Format("%d",s_num);
//date+=sd_mouth;
//date+="月";
date+=sd_day;
date+="日";
if(s_day!=0||s_mouth!=0||s_film!="")
{
pDC->TextOut(150,10,s_film);
pDC->TextOut(150,50,date);
pDC->TextOut(150,90,sd_num);
}
CString str;
str = "放映电影 ";
pDC->TextOut(10,10,str);
str = "上映时间 ";
pDC->TextOut(10,50,str);
str = "已售票数 ";
pDC->TextOut(10,90,str);
m_image1.GetClientRect(m_rect);
pDC=m_image1.GetDC();
pDC->SetBkMode(TRANSPARENT);
CString mouth;
CString day;
CString film;
//CString date="";
int i_day,i_mouth;
GetDlgItem(IDC_MOUTH_COMBO)->GetWindowText(mouth);
GetDlgItem(IDC_DAY_COMBO)->GetWindowText(day);
GetDlgItem(IDC_EDIT_NAME)->GetWindowText(film);
i_day=atoi(day);
i_mouth=atoi(mouth);
date=mouth;
date+=day;
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
CString cSQL;
cSQL.Format("select *from sell where (Film_day = %d and Film_mouth = %d and Film_name = '%s')",i_day,i_mouth,film);
_bstr_t vSQL;
vSQL=(_bstr_t)cSQL;
_RecordsetPtr m_pRecordset;
m_pRecordset = m_AdoConn.GetRecordSet(vSQL);
CString Field,Sell_num;
CString Seat1,Seat2,Seat3,Seat4,Seat5,Seat6,Seat7,Seat8,Seat9,Seat10;
CString Seat11,Seat12,Seat13,Seat14,Seat15,Seat16,Seat17,Seat18,Seat19,Seat20;
CString Seat21,Seat22,Seat23,Seat24,Seat25,Seat26,Seat27,Seat28,Seat29,Seat30;
CString Seat31,Seat32,Seat33,Seat34,Seat35,Seat36,Seat37,Seat38,Seat39,Seat40;
CString Seat41,Seat42,Seat43,Seat44,Seat45,Seat46,Seat47,Seat48,Seat49,Seat50;
CString Seat51,Seat52,Seat53,Seat54,Seat55,Seat56,Seat57,Seat58,Seat59,Seat60;
if(!m_pRecordset->adoEOF)
{
Seat1 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat1");
Seat2 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat2");
Seat3 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat3");
Seat4 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat4");
Seat5 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat5");
Seat6 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat6");
Seat7 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat7");
Seat8 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat8");
Seat9 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat9");
Seat10 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat10");
Seat11 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat11");
Seat12 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat12");
Seat13= (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat13");
Seat14 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat14");
Seat15 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat15");
Seat16 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat16");
Seat17 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat17");
Seat18 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat18");
Seat19 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat19");
Seat20 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat20");
Seat21 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat21");
Seat22 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat22");
Seat23 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat23");
Seat24 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat24");
Seat25 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat25");
Seat26 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat26");
Seat27 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat27");
Seat28 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat28");
Seat29 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat29");
Seat30 = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("seat30");
Field = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("Film_field");
Sell_num = (CString)(char *)(_bstr_t)m_pRecordset->GetCollect("sell_num");
}
if((atoi)(Seat1)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(255,50,18));
}
pDC->TextOut(20,20,"1");
if((atoi)(Seat2)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(255,50,18));
}
pDC->TextOut(60,20,"2");
if((atoi)(Seat3)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(100,20,"3");
if((atoi)(Seat4)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(140,20,"4");
if((atoi)(Seat5)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(180,20,"5");
if((atoi)(Seat6)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(20,70,"6");
if((atoi)(Seat7)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(60,70,"7");
if((atoi)(Seat8)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(100,70,"8");
if((atoi)(Seat9)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(140,70,"9");
if((atoi)(Seat10)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(180,70,"10");
if((atoi)(Seat11)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(20,120,"11");
if((atoi)(Seat12)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
else
{
pDC->SetTextColor(RGB(0,50,18));
}
pDC->TextOut(60,120,"12");
if((atoi)(Seat13)!=0)
{
pDC->SetTextColor(RGB(255,50,18));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -