コード例 #1
0
ファイル: NeuSpread.cs プロジェクト: ewin66/Management-System
 /// <summary>
 /// 设置下拉列表框
 /// </summary>
 /// <param name="listBoxPopup">列表框</param>
 /// <param name="columnIndex">列索引</param>
 /// Robin   2006-12-12
 public void AddListBoxPopup(NeuListBoxPopup listBoxPopup, int columnIndex)
 {
     this.listBoxPopups[columnIndex] = listBoxPopup;
     this.Parent.Controls.Add(listBoxPopup);
     listBoxPopup.Visible = false;
     listBoxPopup.BringToFront();
     listBoxPopup.ItemSelected += new EventHandler(listBoxPopup_ItemSelected);
 }
コード例 #2
0
ファイル: NeuSpread.cs プロジェクト: ewin66/Management-System
        private void listBoxPopup_ItemSelected(object sender, System.EventArgs e)
        {
            int CurrentRow = this.ActiveSheet.ActiveRowIndex;

            if (CurrentRow < 0)
            {
                return;
            }
            NeuListBoxPopup listBoxPopup = sender as NeuListBoxPopup;

            this.StopCellEditing();
            NeuObject item = listBoxPopup.GetSelectedItem();

            if (item == null)
            {
                return;
            }

            this.ActiveSheet.Cells[CurrentRow, this.ActiveSheet.ActiveColumnIndex].Tag = item;
            this.ActiveSheet.SetValue(CurrentRow, this.ActiveSheet.ActiveColumnIndex, item.Name, false);

            listBoxPopup.Visible = false;
        }