當前位置: 首頁>>代碼示例>>C#>>正文


C# CellContext.StartEdit方法代碼示例

本文整理匯總了C#中CellContext.StartEdit方法的典型用法代碼示例。如果您正苦於以下問題:C# CellContext.StartEdit方法的具體用法?C# CellContext.StartEdit怎麽用?C# CellContext.StartEdit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CellContext的用法示例。


在下文中一共展示了CellContext.StartEdit方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnClick

        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        public override void OnClick (CellContext sender, EventArgs e)
        {
            base.OnClick(sender, e);

            if ( sender.Cell.Editor != null && 
                (sender.Cell.Editor.EditableMode & EditableMode.SingleClick) == EditableMode.SingleClick &&
                sender.Grid.Selection.ActivePosition == sender.Position)
                sender.StartEdit();
        }
開發者ID:Xavinightshade,項目名稱:ipsimulator,代碼行數:13,代碼來源:StandardBehavior.cs

示例2: OnKeyDown

        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        public override void OnKeyDown (CellContext sender, KeyEventArgs e)
        {
            base.OnKeyDown(sender, e);

            if (e.KeyCode == Keys.F2 && 
                sender.Cell.Editor != null && ((sender.Cell.Editor.EditableMode & EditableMode.F2Key) == EditableMode.F2Key))
            {
                e.Handled = true;
                sender.StartEdit();
            }
        }
開發者ID:Xavinightshade,項目名稱:ipsimulator,代碼行數:15,代碼來源:StandardBehavior.cs

示例3: OnKeyPress

        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        public override void OnKeyPress (CellContext sender, KeyPressEventArgs e)
        {
            base.OnKeyPress(sender, e);

            if ( sender.Cell.Editor != null &&  
                (sender.Cell.Editor.EditableMode & EditableMode.AnyKey) == EditableMode.AnyKey && 
                sender.IsEditing() == false &&
                char.IsControl( e.KeyChar ) == false )
            {
                e.Handled = true;
                sender.StartEdit();
                sender.Cell.Editor.SendCharToEditor(e.KeyChar);
            }
        }
開發者ID:Xavinightshade,項目名稱:ipsimulator,代碼行數:18,代碼來源:StandardBehavior.cs

示例4: OnFocusEntered

        public override void OnFocusEntered(CellContext sender, EventArgs e)
        {
            base.OnFocusEntered(sender, e);

            //If not visible I move the scroll to show it
            //ORIG:sender.Grid.ShowCell(sender.Position, true);
            //MICK(2)
            sender.Grid.ShowCell(sender.Position, false);

            //Getsione dell'edit sul focus, non lo metto all'interno della cella perchè un utente potrebbe chiamare direttamente il metodo SetFocusCell senza passare dalla cella
            if ( sender.Cell.Editor != null && (sender.Cell.Editor.EditableMode & EditableMode.Focus) == EditableMode.Focus)
                sender.StartEdit();

            if (sender.Grid!=null)
                sender.Grid.InvalidateCell(sender.Position);
        }
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:16,代碼來源:StandardBehavior.cs

示例5: UIChangeChecked

        /// <summary>
        /// Toggle the value of the current cell and if AutoChangeValueOfSelectedCells is true of all the selected cells.
        /// Simulate an edit operation.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UIChangeChecked(CellContext sender, EventArgs e)
        {
            Models.ICheckBox checkModel = (Models.ICheckBox)sender.Cell.Model.FindModel(typeof(Models.ICheckBox));;
            if (checkModel == null)
                throw new SourceGrid.SourceGridException("Models.ICheckBox not found");

            Models.CheckBoxStatus checkStatus = checkModel.GetCheckBoxStatus(sender);
            if (checkStatus.CheckEnable)
            {
                bool newVal = true;
                if (checkStatus.Checked != null)
                    newVal = !checkStatus.Checked.Value;

                sender.StartEdit();
                try
                {
                    checkModel.SetCheckedValue(sender, newVal);
                    sender.EndEdit(false);
                }
                catch(Exception)
                {
                    sender.EndEdit(true);
                    throw;
                }

                //change the status of all selected control
                if (AutoChangeValueOfSelectedCells)
                {
                    foreach(Position pos in sender.Grid.Selection.GetSelectionRegion().GetCellsPositions())
                    {
                        Cells.ICellVirtual c = sender.Grid.GetCell(pos);
                        Models.ICheckBox check;
                        if (c != this && c != null && 
                             (check = (Models.ICheckBox)c.Model.FindModel(typeof(Models.ICheckBox))) != null )
                        {
                            CellContext context = new CellContext(sender.Grid, pos, c);
                            context.StartEdit();
                            try
                            {
                                check.SetCheckedValue(context, newVal);
                                context.EndEdit(false);
                            }
                            catch(Exception)
                            {
                                context.EndEdit(true);
                                throw;
                            }
                        }
                    }
                }
            }
        }
開發者ID:Xavinightshade,項目名稱:ipsimulator,代碼行數:58,代碼來源:CheckBox.cs

示例6: AutoChangeValues

        private void AutoChangeValues(CellContext sender, bool newVal)
        {
            foreach(Position pos in sender.Grid.Selection.GetSelectionRegion().GetCellsPositions())
            {
                Cells.ICellVirtual c = sender.Grid.GetCell(pos);
                Models.ICheckBox check;
                if (c != this && c != null &&
                    (check = (Models.ICheckBox)c.Model.FindModel(typeof(Models.ICheckBox))) != null )
                {
                    CellContext context = new CellContext(sender.Grid, pos, c);
                    context.StartEdit();
                    try
                    {
                        check.SetCheckedValue(context, newVal);
                        context.EndEdit(false);
                    }
                    catch(Exception)
                    {
                        context.EndEdit(true);
                        throw;
                    }
                }
            }
        }
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:24,代碼來源:CheckBox.cs

示例7: UIChangeChecked

        /// <summary>
        /// Toggle the value of the current cell and if AutoChangeValueOfSelectedCells is true of all the selected cells.
        /// Simulate an edit operation.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UIChangeChecked(CellContext sender, EventArgs e)
        {
            Models.ICheckBox checkModel = (Models.ICheckBox)sender.Cell.Model.FindModel(typeof(Models.ICheckBox));;
            if (checkModel == null)
                throw new SourceGrid.SourceGridException("Models.ICheckBox not found");

            Models.CheckBoxStatus checkStatus = checkModel.GetCheckBoxStatus(sender);
            if (checkStatus.CheckEnable)
            {
                bool newVal = true;
                if (checkStatus.Checked != null)
                    newVal = !checkStatus.Checked.Value;

                sender.StartEdit();
                try
                {
                    checkModel.SetCheckedValue(sender, newVal);
                    sender.EndEdit(false);
                    OnCheckedChanged(EventArgs.Empty);
                }
                catch(Exception ex)
                {
                    sender.EndEdit(true);
                    throw new Exception(string.Empty, ex);
                }

                //change the status of all selected control
                if (AutoChangeValueOfSelectedCells)
                {
                    AutoChangeValues(sender, newVal);
                }
            }
        }
開發者ID:wsrf2009,項目名稱:KnxUiEditor,代碼行數:39,代碼來源:CheckBox.cs


注:本文中的CellContext.StartEdit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。