谢谢robert ,按照你的方法,实现了部分需求,还有个问题,请帮忙解答下
按照你的方法,把多列下拉的做出来了,现在的问题是 :
1.我选择了商品名称,怎样把该商品的规格型号,批号显示到控件对应的单元格上,如图所示
2.每个商品有个ID,唯一标示,我在保存数据时,我怎么获得该商品的ID 代码如下:
void gcMultiRow1_EditingControlShowing(object sender, GrapeCity.Win.MultiRow.EditingControlShowingEventArgs e)
{//商品
if (gcMultiRow1.CurrentCell.Name == "comboBoxCell1")
{
ComboBoxEditingControl combo = e.Control as ComboBoxEditingControl;
this.BeginInvoke(new MyDelegate(DelegateMethod), new object[] { combo });
//this.BeginInvoke(new System.Action(() => { combo.DroppedDown = true; }));
// 在加事件之前先减一次,防止事件被挂多次。
combo.KeyUp -= new KeyEventHandler(combo_KeyUp_sp);
combo.DrawItem -= new DrawItemEventHandler(combo_DrawItem_sp);
combo.KeyUp += new KeyEventHandler(combo_KeyUp_sp);
combo.DrawItem += new DrawItemEventHandler(combo_DrawItem_sp);
combo.Items.AddRange((spItems.ToArray()));
combo.DrawMode = DrawMode.OwnerDrawFixed;
combo.ValueMember = "ID";
combo.DisplayMember = "Name";
combo.DropDownWidth = 300;
}
}
spItems 是个 List<SpData>
SpData 有ID,NAME ,SPEC 规格, code 批号
WZS7}E`NZQ@_Q7%OIQIMAY1.jpg (36.04 K, 下载次数:0)
(2012-6-16 10:42:13 上传) |
|