Beispiel #1
0
        private void FpEnter_ItemSelected(object sender, EventArgs e)
        {
            Neusoft.FrameWork.Models.NeuObject obj = new Neusoft.FrameWork.Models.NeuObject();
            Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup current = this.GetCurrentList(this.ActiveSheet, this.ActiveSheet.ActiveColumnIndex);

            if (current == null)
            {
                return;
            }
            obj = current.GetSelectedItem();

            if (obj == null)
            {
                return;
            }

            if (this.SetItem != null)
            {
                this.SetItem(obj);
            }

            current.Visible = false;

            return;
        }
Beispiel #2
0
        /// <summary>
        /// 设置控件位置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FpEnter_EditModeOn(object sender, EventArgs e)
        {
            try
            {
                this.noVisible();

                Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup current = this.GetCurrentList(this.ActiveSheet,
                                                                                                  this.ActiveSheet.ActiveColumnIndex);

                if (current == null)
                {
                    return;
                }

                //设置位置
                this.setLocal(current);

                if (this.showListWhenOfFocus && current.Visible == false)
                {
                    current.Filter(this.ActiveSheet.ActiveCell.Text);
                    current.Visible = true;
                }
            }
            catch { }
        }
Beispiel #3
0
        /// <summary>
        /// 对于有项目列表的,自动进行过滤
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FpEnter_EditChange(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
        {
            try
            {
                Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup current = this.GetCurrentList(this.ActiveSheet,
                                                                                                  this.ActiveSheet.ActiveColumnIndex);

                if (current == null)
                {
                    return;
                }

                string Text = e.EditingControl.Text.Trim();

                current.Filter(Text);

                this.ActiveSheet.SetTag(this.ActiveSheet.ActiveRowIndex, this.ActiveSheet.ActiveColumnIndex, null);

                if (current.Visible == false)
                {
                    current.Visible = true;
                }
            }
            catch { }
        }
Beispiel #4
0
        /// <summary>
        /// 选择项目列表
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        private int FpEnter_SelectItem(Keys key)
        {
            Neusoft.FrameWork.Models.NeuObject obj = new Neusoft.FrameWork.Models.NeuObject();
            Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup current = this.GetCurrentList(this.ActiveSheet, this.ActiveSheet.ActiveColumnIndex);

            if (current == null)
            {
                return(-1);
            }
            obj = current.GetSelectedItem();

            if (obj == null)
            {
                return(-1);
            }

            if (this.SetItem != null)
            {
                this.SetItem(obj);
            }

            current.Visible = false;

            return(0);
        }
Beispiel #5
0
        //private void fpSpread1_Enter(object sender, KeyEventArgs e)
        //{
        //    if (e.KeyCode == Keys.F11)
        //    {
        //        this.AddRow();
        //    }
        //    if (e.KeyCode == Keys.Enter)
        //    {
        //        //挂号科室
        //        if (this.fpEnter1_Sheet1.ActiveColumnIndex == 0)
        //        {
        //            current = this.fpEnter1.GetCurrentList(this.fpEnter1_Sheet1, 0);
        //            if (current == null) return ;

        //            Neusoft.FrameWork.Models.NeuObject obj = current.GetSelectedItem();

        //            if (obj == null) return ;
        //            this.fpEnter1_Sheet1.SetText(this.fpEnter1_Sheet1.ActiveRowIndex, this.fpEnter1_Sheet1.ActiveColumnIndex,
        //                obj.Name);
        //            this.fpEnter1_Sheet1.SetTag(this.fpEnter1_Sheet1.ActiveRowIndex,
        //                this.fpEnter1_Sheet1.ActiveColumnIndex, obj.ID);

        //            this.fpEnter1_Sheet1.SetActiveCell(this.fpEnter1_Sheet1.ActiveRowIndex, 1, false);
        //        }
        //        //显示顺序
        //        else if (this.fpEnter1_Sheet1.ActiveColumnIndex == 1)
        //        {
        //            if (this.fpEnter1_Sheet1.ActiveRowIndex == this.fpEnter1_Sheet1.RowCount - 1)
        //            {
        //                this.AddRow();
        //                this.fpEnter1_Sheet1.SetActiveCell(this.fpEnter1_Sheet1.ActiveRowIndex, 0, false);
        //            }
        //            else
        //            {
        //                this.fpEnter1_Sheet1.ActiveRowIndex++;
        //                this.fpEnter1_Sheet1.SetActiveCell(this.fpEnter1_Sheet1.ActiveRowIndex, 0, false);
        //            }
        //        }
        //    }
        //}

        private int fpEnter1_KeyEnter(Keys key)
        {
            if (key == Keys.F11)
            {
                this.AddRow();
            }
            if (key == Keys.Enter)
            {
                //挂号科室
                if (this.fpEnter1_Sheet1.ActiveColumnIndex == 0)
                {
                    current = this.fpEnter1.GetCurrentList(this.fpEnter1_Sheet1, 0);
                    if (current == null)
                    {
                        return(-1);
                    }

                    Neusoft.FrameWork.Models.NeuObject obj = current.GetSelectedItem();

                    if (obj == null)
                    {
                        return(-1);
                    }
                    this.fpEnter1_Sheet1.SetText(this.fpEnter1_Sheet1.ActiveRowIndex, this.fpEnter1_Sheet1.ActiveColumnIndex,
                                                 obj.Name);
                    this.fpEnter1_Sheet1.SetTag(this.fpEnter1_Sheet1.ActiveRowIndex,
                                                this.fpEnter1_Sheet1.ActiveColumnIndex, obj.ID);

                    this.fpEnter1_Sheet1.SetActiveCell(this.fpEnter1_Sheet1.ActiveRowIndex, 1, false);
                }
                //显示顺序
                else if (this.fpEnter1_Sheet1.ActiveColumnIndex == 1)
                {
                    if (this.fpEnter1_Sheet1.ActiveRowIndex == this.fpEnter1_Sheet1.RowCount - 1)
                    {
                        this.AddRow();
                        this.fpEnter1_Sheet1.SetActiveCell(this.fpEnter1_Sheet1.ActiveRowIndex, 0, false);
                    }
                    else
                    {
                        this.fpEnter1_Sheet1.ActiveRowIndex++;
                        this.fpEnter1_Sheet1.SetActiveCell(this.fpEnter1_Sheet1.ActiveRowIndex, 0, false);
                    }
                }
            }
            return(0);
        }
Beispiel #6
0
        /// <summary>
        /// 设置cell下来列表
        /// </summary>
        /// <param name="view"></param>
        /// <param name="col"></param>
        /// <param name="al"></param>
        public void SetColumnList(FarPoint.Win.Spread.SheetView view, int col, ArrayList al)
        {
            string name = view.SheetName + "_" + col.ToString();

            for (int i = 0; i < this.Lists.Length - 1; i++)
            {
                if (this.Lists[i] != null && (this.Lists[i] as Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup).Name == name)
                {
                    return;
                }
            }

            Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup obj = new Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup();
            obj.Name = name;
            obj.AddItems(al);
            //得到最大列表数
            int Index = -1;

            for (int i = 0; i < this.Lists.Length; i++)
            {
                if (this.Lists[i] == null)
                {
                    Index = i;
                    break;
                }
            }
            if (Index == -1)
            {
                MessageBox.Show("列表已经超过最大数10", "提示");
                return;
            }

            this.Lists[Index] = obj;
            this.Lists[Index].ItemSelected += new EventHandler(FpEnter_ItemSelected);
            //this.Lists[Index].ItemSelected += new Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup(FpEnter_SelectItem);
            this.Controls.Add(this.Lists[Index]);
            this.Lists[Index].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.Lists[Index].Cursor      = Cursors.Hand;
            this.Lists[Index].Size        = new System.Drawing.Size(intWidth, intHeight);
            this.Lists[Index].Visible     = false;
            //this.Lists[Index].SelectNone = selectNone;
        }
Beispiel #7
0
        /// <summary>
        /// 设置控件位置
        /// </summary>
        /// <param name="obj"></param>
        private void setLocal(Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup obj)
        {
            Control _cell = base.EditingControl;

            if (_cell == null)
            {
                return;
            }

            int y = _cell.Top + _cell.Height + obj.Height;//+SystemInformation.Border3DSize.Height*2;

            if (y <= this.Height)
            {
                obj.Location = new System.Drawing.Point(_cell.Left, y - obj.Height);
            }
            else
            {
                obj.Location = new System.Drawing.Point(_cell.Left, _cell.Top - obj.Height);
            }
        }
Beispiel #8
0
        /// <summary>
        /// 响应按键事件
        /// </summary>
        /// <param name="keyData"></param>
        /// <returns></returns>
        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (this.ContainsFocus)
            {
                if (keyData == Keys.Enter)
                {
                    if (this.KeyEnter != null)
                    {
                        this.KeyEnter(Keys.Enter);
                    }
                }
                else if (keyData == Keys.Up)
                {
                    Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup current = this.GetCurrentList(this.ActiveSheet, this.ActiveSheet.ActiveColumnIndex);

                    if (current != null && current.Visible)
                    {
                        current.PriorRow();
                    }
                    else
                    {
                        if (this.ActiveSheet.ActiveRowIndex > 0)
                        {
                            this.ActiveSheet.ActiveRowIndex--;
                        }
                    }

                    if (this.KeyEnter != null)
                    {
                        this.KeyEnter(Keys.Up);
                    }
                }
                else if (keyData == Keys.Down)
                {
                    Neusoft.FrameWork.WinForms.Controls.NeuListBoxPopup current = this.GetCurrentList(this.ActiveSheet, this.ActiveSheet.ActiveColumnIndex);
                    if (current != null && current.Visible)
                    {
                        current.NextRow();
                    }
                    else
                    {
                        if (this.ActiveSheet.ActiveRowIndex < this.ActiveSheet.RowCount - 1)
                        {
                            this.ActiveSheet.ActiveRowIndex++;
                        }
                    }

                    if (this.KeyEnter != null)
                    {
                        this.KeyEnter(Keys.Down);
                    }
                }
                else if (keyData == Keys.Escape)
                {
                    this.noVisible();

                    if (this.KeyEnter != null)
                    {
                        this.KeyEnter(Keys.Escape);
                    }
                }
            }
            return(base.ProcessDialogKey(keyData));
        }