【VC开源代码栏目提醒】:网学会员鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“DlgXSTH.cpp”一文,供大家参考学习
// DlgXSTH.cpp : implementation file
//
#include "stdafx.h"
#include "a1.h"
#include "DlgXSTH.h"
#include "DlgXSINFO.h"
#include "DlgXSTHINFO.h"
#include "ScrollPrintView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgXSTH dialog
CDlgXSTH::CDlgXSTH(bool isxsth,CWnd* pParent /*=NULL*/)
: CDialog(CDlgXSTH::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgXSTH)
m_tRq = 0;
m_iJsr = -1;
m_iJsfs = -1;
//}}AFX_DATA_INIT
m_bXsth=isxsth;
m_plistTH=NULL;
m_draw=new CDrawTH(this);
}
void CDlgXSTH::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgXSTH)
DDX_Control(pDX, IDC_BUTTON_OK, m_btnOk);
DDX_Control(pDX, IDCANCEL, m_btnCancel);
DDX_Control(pDX, IDC_BUTTON_DEL, m_btnDel);
DDX_Control(pDX, IDC_DATETIMEPICKER1, m_tcRq);
DDX_Control(pDX, IDC_EDIT2, m_editThPh);
DDX_Control(pDX, IDC_EDIT1, m_editDjPh);
DDX_Control(pDX, IDC_COMBO2, m_comboJsfs);
DDX_Control(pDX, IDC_COMBO1, m_comboJsr);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_tRq);
DDX_CBIndex(pDX, IDC_COMBO1, m_iJsr);
DDX_CBIndex(pDX, IDC_COMBO2, m_iJsfs);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgXSTH, CDialog)
//{{AFX_MSG_MAP(CDlgXSTH)
ON_BN_CLICKED(IDC_BUTTON_OK, OnButtonOk)
ON_WM_MOVE()
ON_BN_CLICKED(IDC_BUTTON_DEL, OnButtonDel)
ON_BN_CLICKED(IDC_BUTTON_PRINT, OnButtonPrint)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgXSTH message handlers
void CDlgXSTH::OnOK()
{
// TODO: Add extra validation here
//CDialog::OnOK();
}
BOOL CDlgXSTH::OnInitDialog()
{
if(this->m_bXsth)
{
CDlgXSINFO dlg;
while(dlg.xs_ph=="")
{
if(MessageBox("要进行销售退货,必须先选择销售票号!","注意!",
MB_YESNO)!=IDYES)
{
this->EndDialog(0);
return true;
}
dlg.DoModal();
}
m_strPh=dlg.xs_ph;
}
else
{
CDlgXSTHINFO dlg(15,RK);
while(dlg.ph=="")
{
if(MessageBox("要进行入库退货,必须先选择入库票号!","注意!",
MB_YESNO)!=IDYES)
{
this->EndDialog(0);
return true;
} dlg.DoModal();
}
m_strPh=dlg.ph;
}
CDialog::OnInitDialog();
InitBaseInfo();
InitnListTH();
::PostMessage(this->m_tcRq.GetSafeHwnd(),WM_ACTIVATE ,WA_CLICKACTIVE,0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
bool CDlgXSTH::InitnListTH()
{
CRect rect_nlist(10,300,700,650);
this->GetClientRect(&rect_nlist);
rect_nlist.top=150;
rect_nlist.left+=10;
rect_nlist.right-=10;
rect_nlist.bottom=330;
this->m_plistTH=new CListXSTH(m_bXsth,this->m_strPh);
m_plistTH->Create(WS_CHILD|WS_VISIBLE|LVS_REPORT|
WS_BORDER,rect_nlist,this,ID_NEWLISTLSXSDJ);
//this->m_plistTH->OnParentMoved();
this->m_plistTH->ModifyStyle(LVS_EDITLABELS, 0L); //禁止标题编辑
m_plistTH->ModifyStyle(0L, LVS_REPORT); //设为Report类型
m_plistTH->ModifyStyle(0L, LVS_SHOWSELALWAYS); //始终高亮度被选中的表项
m_plistTH->ModifyStyle(0L, LVS_NOSORTHEADER);
// m_plistTH->SetBkColor(RGB(0,200,200));
// m_plistTH->SetTextBkColor(RGB(0,200,200));
m_plistTH->ModifyStyle( LVS_OWNERDRAWFIXED,0L);
m_plistTH->SetExtendedStyle( LVS_EX_FULLROWSELECT | //允许整行选中
// LVS_EX_HEADERDRAGDROP | //允许整列拖动
LVS_EX_GRIDLINES | //画出网格线
// LVS_EX_ONECLICKACTIVATE | //单击选中表项