本文整理汇总了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();
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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;
}
}
}
}
}
}
示例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;
}
}
}
}
示例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);
}
}
}