【VC开源代码栏目提醒】:网学会员为需要VC开源代码的朋友们搜集整理了DlgStorePD3.cpp相关资料,希望对各位网友有所帮助!
// DlgStorePD3.cpp : implementation file
//
#include "stdafx.h"
#include "aaa.h"
#include "DlgStorePD3.h"
#include "CustomGrid.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern _ConnectionPtr m_pCon;
extern _RecordsetPtr m_pRs;
extern CAaaApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CDlgStorePD3 dialog
CDlgStorePD3::CDlgStorePD3(CWnd* pParent /*=NULL*/)
: CDialog(CDlgStorePD3::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgStorePD3)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDlgStorePD3::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgStorePD3)
DDX_Control(pDX, IDC_STORE_PD_PERSON, memo);
DDX_Control(pDX, IDC_STORE_MARK, checkman);
DDX_Control(pDX, IDC_DATETIMEPICKER1, checktime);
DDX_Control(pDX, IDC_COMBO2, checkspec);
DDX_Control(pDX, IDC_LIST3, listinfo);
DDX_Control(pDX, IDC_LIST1, list);
DDX_Control(pDX, IDC_COMBO1, storagename);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgStorePD3, CDialog)
//{{AFX_MSG_MAP(CDlgStorePD3)
ON_NOTIFY(NM_DBLCLK, IDC_LIST3, OnDblclkList3)
ON_NOTIFY(LVN_KEYDOWN, IDC_LIST3, OnKeydownList3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgStorePD3 message handlers
void CDlgStorePD3::AddStorage()
{
storagename.ResetContent();
m_pRs->Close();
CString sql;
sql.Format("select storagename from tb_storageinfo");
m_pRs->Open((_variant_t)sql,m_pCon.GetInterfacePtr(),adOpenKeyset,adLockOptimistic,adCmdText);
while (! m_pRs->adoEOF)
{
storagename.AddString((TCHAR*)(_bstr_t)m_pRs->GetFields()->GetItem((long)0)->Value);
m_pRs->MoveNext();
}
}
BOOL CDlgStorePD3::OnInitDialog()
{
CDialog::OnInitDialog();
//添加仓库名称
AddStorage();
list.InsertColumn(0,"商品编号");
list.InsertColumn(1,"商品名称");
list.InsertColumn(2,"规格");
list.InsertColumn(3,"数量");
listinfo.ModifyStyle(LVS_EDITLABELS,0);//禁止编辑标题
listinfo.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_ONECLICKACTIVATE|LVS_EX_INFOTIP|LVS_EX_SUBITEMIMAGES|LVS_EX_GRIDLINES );
listinfo.InsertColumn(0,"商品编号");
listinfo.InsertColumn(1,"商品名称");
listinfo.InsertColumn(2,"规格");
listinfo.InsertColumn(3,"助记码");
listinfo.InsertColumn(4,"默认价格");
//设置列宽度
list.SetColumnWidth(0,150);
list.SetColumnWidth(1,250);
list.SetColumnWidth(2,80);
list.SetColumnWidth(3,80);
listinfo.SetColumnWidth(0,80);
listinfo.SetColumnWidth(1,100);
listinfo.SetColumnWidth(2,60);
listinfo.SetColumnWidth(3,60);
listinfo.SetColumnWidth(4,60);
//添加一行
list.InsertItem(0,"");
listinfo.SetParent(&list);
return TRUE; // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CDlgStorePD3::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
{
if (pMsg->hwnd == list.edit.m_hWnd)
{
LimitEdit();
if (pMsg->wParam == 34)
{
ShowListinfo();
}
else if (pMsg->wParam ==VK_DELETE)//按delete键删除表格当前行
DeleteCurRow();
}
else if ((pMsg->hwnd ==listinfo.m_hWnd)&&(pMsg->wParam == 13))
{
OnDblclkList3(NULL,NULL);
return true;
}
/****************************************************************
说明: 表格中编辑框获得焦点时,按Enter键控制单元格焦点移动
****************************************************************/
if ((pMsg->wParam == 13)&&(p