コード例 #1
0
        private void fpSpread1_EditChange(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
        {
            //this.ParentForm.Text = "EditChange";
            if (_control != null)
            {
                _control.BringToFront();
                _control.Show();

                IFpInputable _editor = _control as IFpInputable;
                if (_editor != null)
                {
                    try
                    {
                        _editor.Filter(e.EditingControl.Text);
                    }
                    catch {}
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// 设置cellControl
 /// </summary>
 /// <param name="controls"></param>
 public void SetCellControl(params Control[] controls)
 {
     alControls = new ArrayList();
     for (int i = 0; i < controls.Length; i++)
     {
         alControls.Add(controls[i]);
         this.Controls.Add(controls[i]);
         try
         {
             if (controls[i] != null)
             {
                 controls[i].Visible = false;
                 controls[i].BringToFront();
                 IFpInputable ifp = controls[i] as IFpInputable;
                 if (ifp != null)
                 {
                     ifp.SelectedItem += new EventHandler(ifp_SelectedItem);
                 }
             }
         }
         catch {}
     }
 }
コード例 #3
0
 private void fpSpread1_EditModeOn(object sender, System.EventArgs e)
 {
     //this.ParentForm.Text = "EditModeOn";
     this.SetLocation();
     if (_control != null)
     {
         IFpInputable _editor = _control as IFpInputable;
         if (_editor != null)
         {
             try
             {
                 _editor.Filter(this.fpSpread1.EditingControl.Text);
             }
             catch {}
         }
     }
     for (int i = 0; i < this.alControls.Count; i++)
     {
         if (this.alControls[i] != null && this.alControls[i] != _control)
         {
             ((Control)this.alControls[i]).Hide();
         }
     }
 }
コード例 #4
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Escape)
            {
                if (_control != null && _control.Visible == true) //如果有控件
                {
                    _control.Hide();                              //隐藏控件
                }
            }
            if (_control != null && _control.Visible)
            {
                #region 当前列表显示时候
                IFpInputable _editor = _control as IFpInputable;
                if (_editor != null)
                {
                    if (keyData == Keys.Up)
                    {
                        _editor.MovePrevious();
                    }
                    else if (keyData == Keys.Down)
                    {
                        _editor.MoveNext();
                    }
                    else if (keyData == Keys.PageUp)
                    {
                        _editor.PreviousPage();
                    }
                    else if (keyData == Keys.PageDown)
                    {
                        _editor.NextPage();
                    }
                    else if (keyData == Keys.Enter)
                    {
                        object obj = _editor.GetSelectedItem();
                        if (obj != null && obj.ToString() != "")
                        {
                            try
                            {
                                this.SheetView.ActiveCell.Tag  = obj;
                                this.SheetView.ActiveCell.Text = obj.ToString();
                            }
                            catch {}
                        }
                        _control.Hide();
                    }
                }
                #endregion
            }
            else            //没有列表时候,进行行列选择
            {
                if (keyData == Keys.Up)
                {
                    if (this.fpSpread1.Sheets[0].ActiveRowIndex > 0)
                    {
                        this.fpSpread1.Sheets[0].SetActiveCell(this.fpSpread1.Sheets[0].ActiveRowIndex - 1, this.fpSpread1.Sheets[0].ActiveColumnIndex);
                    }
                }
                else if (keyData == Keys.Down)
                {
                    if (this.fpSpread1.Sheets[0].ActiveRowIndex < this.fpSpread1.Sheets[0].RowCount - 1)
                    {
                        this.fpSpread1.Sheets[0].SetActiveCell(this.fpSpread1.Sheets[0].ActiveRowIndex + 1, this.fpSpread1.Sheets[0].ActiveColumnIndex);
                    }
                }
                else if (keyData == Keys.Left || keyData == Keys.Right)
                {
                    if (_control != null)
                    {
                        _control.Show();                                   //如果有控件没显示给显示出来
                    }
                }
            }
            if (this.IsAutoSkip && (keyData == Keys.Enter))
            {
                this.skip();
            }

            if (KeyPressEvent != null)
            {
                KeyPressEventArgs e = new KeyPressEventArgs((char)keyData.GetHashCode());
                KeyPressEvent(this, e);
            }


            return(base.ProcessCmdKey(ref msg, keyData));
        }