Пример #1
0
        /// <summary>
        /// 将 <paramref name="cell"/> 置于编辑状态。
        /// </summary>
        /// <param name="cell">要编辑的单元格。</param>
        /// <param name="rect">编辑器放置的位置。</param>
        public void BeginEdit(TreeListCell cell, Rectangle rect)
        {
            Guard.ArgumentNull(cell, "cell");

            if (IsEditing && cell == Cell)
            {
                return;
            }

            rect.Inflate(-1, -1);

            AcceptEdit();

            if (!cell.Column.Editable || cell.Column.Editor == null)
            {
                return;
            }

            editor = cell.Column.Editor;
            Cell   = cell;
            var control = (Control)editor;

            treelist.Controls.Add(control);

            IsEditing         = true;
            editor.Controller = this;
            editor.SetValue(cell.Value);
            editor.Show(rect);
        }
Пример #2
0
 /// <summary>
 /// 移除单元格编辑器。
 /// </summary>
 private void RemoveEditor()
 {
     IsEditing = false;
     if (_editor != null)
     {
         _editor.Hide();
         _treelist.Focus();
         _treelist.Controls.Remove((Control)_editor);
     }
     _editor = null;
 }
Пример #3
0
        /// <summary>
        /// 移除单元格编辑器。
        /// </summary>
        private void RemoveEditor()
        {
            var control = (Control)editor;

            IsEditing = false;
            treelist.Focus();
            treelist.Controls.Remove(control);
            if (editor != null)
            {
                editor.Hide();
            }
            editor = null;
        }
Пример #4
0
 /// <summary>
 /// 设置编辑器对象。
 /// </summary>
 /// <param name="editor">用于编辑此列的编辑器。</param>
 public void SetEditor(ITreeListEditor editor)
 {
     Editor = editor;
 }