/// <summary> /// 设置控件位置 /// </summary> /// <param name="obj">弹出列表控件</param> private void SetListLocation(neusoft.neuFC.Interface.Controls.ListBox obj) { Control _cell = base.EditingControl; if (_cell == null) { return; } int y = _cell.Top + _cell.Height + obj.Height; if (y <= this.Height) { obj.Location = new System.Drawing.Point(_cell.Left, y - obj.Height); } else { if (_cell.Top > obj.Height) { obj.Location = new System.Drawing.Point(_cell.Left, _cell.Top - obj.Height); } else { obj.Location = new System.Drawing.Point(_cell.Left, _cell.Top + _cell.Height); } } }
protected override void OnEditModeOn(EventArgs e) { if (this.phaListEnabled && this.ucPhaItem1 != null && this.ActiveSheet.ActiveRowIndex == this.phaListColumnIndex) { this.SetListLocation(); if (this.ActiveSheet.ActiveColumnIndex != this.phaListColumnIndex) { this.ucPhaItem1.Visible = false; } } if (this.listBoxEnabled && this.Lists != null && this.Lists.Count > 0) { this.VisibleAllList(); if (this.JudgeListRow(this.ActiveSheet.ActiveRowIndex)) { if (this.ActiveSheet.ActiveColumn.Visible) { #region 当前列为显示状态时 才进行处理 string str = this.ActiveSheet.SheetName + this.ActiveSheet.ActiveColumnIndex.ToString(); int iIndex = this.GetListIndex(str); if (iIndex != -1) { neusoft.neuFC.Interface.Controls.ListBox current = null; current = this.Lists[iIndex] as neusoft.neuFC.Interface.Controls.ListBox; if (current != null) { //设置位置 this.SetListLocation(current); if (current.Visible == false) { current.Visible = true; } } } #endregion } } } base.OnEditModeOn(e); }
protected override void OnEditChange(FarPoint.Win.Spread.EditorNotifyEventArgs e) { if (this.phaListEnabled && this.ucPhaItem1 != null) { if (e.Column == this.phaListColumnIndex && this.ucPhaItem1 != null) { this.ucPhaItem1.BringToFront(); if (!this.ucPhaItem1.Visible) { this.ucPhaItem1.Visible = true; } this.ucPhaItem1.Filter(this.ActiveSheet.ActiveCell.Text); } } if (this.listBoxEnabled && this.Lists != null && this.Lists.Count > 0) { if (this.JudgeListRow(e.Row)) { string str = this.ActiveSheet.SheetName + e.Column.ToString(); int iIndex = this.GetListIndex(str); if (iIndex != -1) { neusoft.neuFC.Interface.Controls.ListBox current = null; current = this.Lists[iIndex] as neusoft.neuFC.Interface.Controls.ListBox; if (current != null) { current.Filter(e.EditingControl.Text.Trim()); if (current.Visible == false) { current.Visible = true; } } } } } base.OnEditChange(e); }
/// <summary> /// 从下拉列表获取所选择项目 /// </summary> private neusoft.neuFC.Object.neuObject GetItemFormList() { neusoft.neuFC.Object.neuObject obj = new neusoft.neuFC.Object.neuObject(); string str = this.ActiveSheet.SheetName + this.ActiveSheet.ActiveColumnIndex.ToString(); int iIndex = this.GetListIndex(str); if (iIndex == -1 || iIndex >= this.Lists.Count) { return(null); } neusoft.neuFC.Interface.Controls.ListBox current = null; current = this.Lists[iIndex] as neusoft.neuFC.Interface.Controls.ListBox; if (current != null && current.Visible) { if (current.GetSelectedItem(out obj) == -1) { return(null); } current.Visible = false; return(obj); } return(null); }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (this.phaListEnabled && this.ucPhaItem1 != null && this.ucPhaItem1.Visible && this.ContainsFocus && this.ActiveSheet.ActiveColumnIndex == this.phaListColumnIndex) { #region 处理药品列表 if (keyData == Keys.Enter || keyData == Keys.Escape) { this.ucPhaItem1.Key(keyData); } else if (keyData == Keys.Up || keyData == Keys.Down) { if (this.ucPhaItem1.Visible) { this.ucPhaItem1.Key(keyData); return(true); } } #endregion } else if (this.listBoxEnabled && this.Lists != null && this.Lists.Count > 0) { #region 拉列表 if (keyData == Keys.Up || keyData == Keys.Down) { #region 键 string str = this.ActiveSheet.SheetName + this.ActiveSheet.ActiveColumnIndex.ToString(); int iIndex = this.GetListIndex(str); neusoft.neuFC.Interface.Controls.ListBox current = null; if (iIndex != -1) { current = this.Lists[iIndex] as neusoft.neuFC.Interface.Controls.ListBox; } if (current != null && current.Visible) { if (keyData == Keys.Up) { current.PriorRow(); } else { current.NextRow(); } } else { if (keyData == Keys.Up) { this.ActiveSheet.ActiveRowIndex--; } else { this.ActiveSheet.ActiveRowIndex++; } } #endregion } else if (keyData == Keys.Enter) { this.obj_SelectItem(keyData); } #endregion } if (this.KeyEvent != null) { this.KeyEvent(keyData, System.EventArgs.Empty); } return(base.ProcessCmdKey(ref msg, keyData)); }