📄 touristlog.cpp
字号:
// touristlog.cpp : implementation file
//
#include "stdafx.h"
#include "flowerSaleSystem.h"
#include "touristlog.h"
#include "toursign.h"
#include "warehouse.h"
#include "price.h";
#include "supply.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// touristlog dialog
touristlog::touristlog(CWnd* pParent /*=NULL*/)
: CDialog(touristlog::IDD, pParent)
{
//{{AFX_DATA_INIT(touristlog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void touristlog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(touristlog)
DDX_Control(pDX, IDC_LIST1, m_hot);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(touristlog, CDialog)
//{{AFX_MSG_MAP(touristlog)
ON_BN_CLICKED(IDC_BUTTONsign, OnBUTTONsign)
ON_WM_PAINT()
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// touristlog message handlers
BOOL touristlog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_hot.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
m_hot.SetBkColor(RGB(0,0,0));
m_hot.SetTextColor(RGB(0,255,0));
m_hot.SetTextBkColor(RGB(0,0,0));
m_font.CreateFont(16, 0,0,0,FW_NORMAL, 0,0,0,
DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Georgia");
m_hot.SetFont(&m_font);
m_hot.InsertColumn(0,"花号",LVCFMT_CENTER,80);
m_hot.InsertColumn(1,"花名",LVCFMT_CENTER,60);
m_hot.InsertColumn(2,"产地",LVCFMT_CENTER,60);
m_hot.InsertColumn(3,"原价",LVCFMT_CENTER,60);
m_hot.InsertColumn(4,"折扣",LVCFMT_CENTER,60);
m_hot.InsertColumn(5,"现价",LVCFMT_CENTER,60);
m_brush.CreateSolidBrush(RGB(0,0,0));
m_hot.DeleteAllItems();
warehouse wa;
int n=0;
CString s;
wa.Open();
while(!wa.IsEOF())
{
price pr;
pr.m_strFilter.Format("fid='%s'",wa.m_wid);
if(pr.Open())
{
if(!pr.IsEOF())
{
if(pr.m_fdiscount!=1)
{
m_hot.InsertItem(n,"");
m_hot.SetItemText(n,0,wa.m_wid);
m_hot.SetItemText(n,1,wa.m_wnaem);
supply su;
su.m_strFilter.Format("sid='%s'",wa.m_wid);
if(su.Open())
{
if(!su.IsEOF())
{
m_hot.SetItemText(n,2,su.m_scity);
}
}
su.Close();
s.Format("%g",pr.m_retailPrice);
m_hot.SetItemText(n,3,s);
s.Format("%g",pr.m_fdiscount);
m_hot.SetItemText(n,4,s);
s.Format("%g",pr.m_fdiscount*pr.m_retailPrice);
n++;
}
}
}
pr.Close();
wa.MoveNext();
}
wa.Close();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void touristlog::OnBUTTONsign()
{
// TODO: Add your control notification handler code here
toursign sndlg;
sndlg.DoModal();
}
void touristlog::OnPaint()
{
CPaintDC dc(this); // device context for painting
CDC memDC;
CBitmap bitmap;
BITMAP bmp;
bitmap.LoadBitmap(IDB_BITMAPt);
bitmap.GetObject (sizeof(BITMAP),&bmp);
memDC.CreateCompatibleDC (&dc);
memDC.SelectObject (bitmap);
dc.BitBlt (0,0,bmp.bmWidth ,bmp.bmHeight ,&memDC,0,0,SRCCOPY);
// Do not call CDialog::OnPaint() for painting messages
}
HBRUSH touristlog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_LISTBOX)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(255,0,0));
return m_brush;
}
if(nCtlColor==CTLCOLOR_EDIT)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(0,255,0));
return m_brush;
}
if(nCtlColor==CTLCOLOR_STATIC)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(255,255,0));
return m_brush
;
}
if(nCtlColor==CTLCOLOR_DLG)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(175,216,229)); //浅色字体
return hbr;
}if(nCtlColor==CTLCOLOR_LISTBOX)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(255,0,0));
return m_brush;
}
if(nCtlColor==CTLCOLOR_EDIT)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(0,255,0));
return m_brush;
}
if(nCtlColor==CTLCOLOR_STATIC)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(255,255,0));
return m_brush
;
}
if(nCtlColor==CTLCOLOR_DLG)
{
pDC->SetBkMode(TRANSPARENT);//
pDC->SetTextColor(RGB(175,216,229)); //浅色字体
return hbr;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -