nt i=0;
while(! m_pRs->adoEOF)
{
listinfo.InsertItem(100,"");
for (int m = 0;m<5;m++)
listinfo.SetItemText(i,m,(TCHAR*)(_bstr_t)m_pRs->GetFields()->GetItem((long)m)->Value);
m_pRs->MoveNext();
i +=1;
}
ShowListInfo();
}
else
listinfo.ShowWindow(SW_HIDE);
}
else
listinfo.ShowWindow(SW_HIDE);
}
void CDlgStorePD3::ShowListInfo()
{
CRect rect;
list.GetSubItemRect(list.row,list.col,LVIR_BOUNDS,rect);
listinfo.MoveWindow(rect.left,rect.bottom+1,300,150);
listinfo.ShowWindow(SW_SHOW);
}
void CDlgStorePD3::OnDblclkList3(NMHDR* pNMHDR, LRESULT* pResult)
{
int row = listinfo.GetSelectionMark();
if (row!=-1)
{
CString temp;
temp = listinfo.GetItemText(row,0);
//设置商品编号
list.SetItemText(list.row,0,temp);
//设置商品名称
list.SetItemText(list.row,1,listinfo.GetItemText(row,1));
list.SetItemText(list.row,2,listinfo.GetItemText(row,2));
listinfo.ShowWindow(SW_HIDE);
}
//移动编辑框
//MoveFocus();
list.col =3;
list.ShowEdit();
//*pResult = 0;
}
void CDlgStorePD3::OnKeydownList3(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_KEYDOWN* pLVKeyDow = (LV_KEYDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
*pResult = 0;
}
void CDlgStorePD3::MoveFocus()
{
list.DisposeEdit(true);
if (list.col <4)
{
list.col = list.col+1;
CString tempID,tempname;
tempID = list.GetItemText(list.row,0);
tempname = list.GetItemText(list.row,1);
list.showedit = true;
if ((tempname.IsEmpty()==false)&&(list.col == 0))
list.showedit =false;
else if((tempID.IsEmpty()==false)&&(list.col == 1))
list.showedit =false;
list.ShowEdit();
}
else
{
AddNewRow();
}
}
void CDlgStorePD3::AddNewRow()
{
int counts = list.GetItemCount();
if (list.row == counts-
上一篇:
CKD.pas
下一篇:
美术教学中网络信息论文