本文整理汇总了C#中CellContext.IsEditing方法的典型用法代码示例。如果您正苦于以下问题:C# CellContext.IsEditing方法的具体用法?C# CellContext.IsEditing怎么用?C# CellContext.IsEditing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CellContext
的用法示例。
在下文中一共展示了CellContext.IsEditing方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: grid_MouseDown
protected virtual void grid_MouseDown(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
{
//verifico che l'eventuale edit sia terminato altrimenti esco
if (sender.Selection.ActivePosition.IsEmpty() == false)
{
CellContext focusCell = new CellContext(sender, sender.Selection.ActivePosition);
if (focusCell.Cell != null && focusCell.IsEditing())
{
if (focusCell.EndEdit(false) == false)
return;
}
}
//scateno eventi di MouseDown
Position position = sender.PositionAtPoint( new Point(e.X, e.Y) );
if (position.IsEmpty() == false)
{
Cells.ICellVirtual cellMouseDown = sender.GetCell(position);
if (cellMouseDown != null)
{
sender.ChangeMouseDownCell(position, position);
//Cell.OnMouseDown
CellContext cellContext = new CellContext(sender, position, cellMouseDown);
sender.Controller.OnMouseDown(cellContext, e);
}
}
else
sender.ChangeMouseDownCell(Position.Empty, Position.Empty);
}
示例2: Draw
public override void Draw(RangePaintEventArgs e)
{
RangeRegion region = mSelection.GetSelectionRegion();
if (region.IsEmpty())
return;
// get visible range for scrollable area
Range visibleScrollabeRange = mSelection.Grid.RangeAtAreaExpanded(CellPositionType.Scrollable);
System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);
CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);
// get focus rectangle
// clipped to visible range
Range focusClippedRange = visibleScrollabeRange.Intersect(new Range(mSelection.ActivePosition, mSelection.ActivePosition));
System.Drawing.Rectangle focusRect = e.Grid.PositionToRectangle(focusClippedRange.Start);
//Draw each selection range
foreach (Range rangeToLoop in region)
{
// intersect given range with visible range
// this way we ensure we don't loop through thousands
// of rows to calculate rectToDraw
Range rng = visibleScrollabeRange.Intersect(rangeToLoop);
System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
if (rectToDraw == System.Drawing.Rectangle.Empty)
continue;
System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);
if (rectToDraw.IntersectsWith(focusRect))
regionToDraw.Exclude(focusRect);
e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);
//Draw the border only if there isn't a editing cell
// and is the range that contains the focus or there is a single range
if (rng.Contains(mSelection.ActivePosition) || region.Count == 1)
{
if (focusContext.IsEditing() == false)
mSelection.Border.Draw(e.GraphicsCache, rectToDraw);
}
}
//Draw Focus
System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
}
示例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: grid_MouseDown
protected virtual void grid_MouseDown(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
{
//Check if the cell is valid
if (sender.Selection.ActivePosition.IsEmpty() == false)
{
//If the cell is still active exit
if (sender.MouseDownPosition == sender.Selection.ActivePosition)
return;
//If the cell is still in editing then exit and stop the multi selection
CellContext focusCell = new CellContext(sender, sender.Selection.ActivePosition);
if (focusCell.Cell != null && focusCell.IsEditing())
return;
}
#warning Da fare
////Select the cell
//if (sender.MouseDownPosition.IsEmpty() == false)
//{
// Cells.ICellVirtual cellMouseDown = sender.GetCell(sender.MouseDownPosition);
// if (cellMouseDown != null)
// {
// //Only select the cell if click inside or ourside the selection area (if click inside the border is not considered)
// float distance;
// DevAge.Drawing.RectanglePartType partType = sender.Selection.Border.GetPointPartType(sender.Selection.GetDrawingRectangle(),
// new System.Drawing.Point( e.X, e.Y) , out distance);
// if (partType == DevAge.Drawing.RectanglePartType.ContentArea ||
// partType == DevAge.Drawing.RectanglePartType.None)
// {
// bool l_bShiftPress = ((Control.ModifierKeys & Keys.Shift) == Keys.Shift &&
// (sender.SpecialKeys & GridSpecialKeys.Shift) == GridSpecialKeys.Shift);
// if (l_bShiftPress == false ||
// sender.Selection.EnableMultiSelection == false ||
// sender.Selection.ActivePosition.IsEmpty() )
// {
// //Standard focus on the cell on MouseDown
// if (sender.Selection.Contains(sender.MouseDownPosition) == false || e.Button == MouseButtons.Left) //solo se non è stata ancora selezionata
// sender.Selection.Focus(sender.MouseDownPosition);
// }
// else //handle shift key
// {
// sender.Selection.Clear();
// Range rangeToSelect = new Range(sender.Selection.ActivePosition, sender.MouseDownPosition);
// sender.Selection.Add(rangeToSelect);
// }
// }
// }
//}
}
示例5: Draw
public override void Draw(RangePaintEventArgs e)
{
RangeRegion region = mSelection.GetSelectionRegion();
if (region.IsEmpty())
return;
System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);
CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);
System.Drawing.Rectangle focusRect = e.Grid.PositionToRectangle(mSelection.ActivePosition);
RangeCollection ranges = region.GetRanges();
//Draw each selection range
foreach (Range rng in ranges)
{
System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
if (rectToDraw == System.Drawing.Rectangle.Empty)
continue;
System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);
if (rectToDraw.IntersectsWith(focusRect))
regionToDraw.Exclude(focusRect);
e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);
//Draw the border only if there isn't a editing cell
// and is the range that contains the focus or there is a single range
if (rng.Contains(mSelection.ActivePosition) || ranges.Count == 1)
{
if (focusContext == null || focusContext.IsEditing() == false)
mSelection.Border.Draw(e.GraphicsCache, rectToDraw);
}
}
//Draw Focus
System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
}
示例6: grid_MouseMove
protected virtual void grid_MouseMove(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left && sender.Selection.EnableMultiSelection)
{
//Scroll if necesary
sender.ScrollOnPoint(e.Location);
Position pointPosition = sender.PositionAtPoint(e.Location);
Cells.ICellVirtual cellPosition = sender.GetCell(pointPosition);
//Only if there is a FocusCell
CellContext focusCellContext = new CellContext(sender, sender.Selection.ActivePosition);
if (focusCellContext.Cell != null && focusCellContext.IsEditing() ==false)
{
Position selCornerPos = pointPosition;
Cells.ICellVirtual selCorner = cellPosition;
////If the current Focus Cell is a scrollable cell then search the current cell (under the mouse)only in scrollable cells
//// see PositionAtPoint with false parameter
//if (sender.GetPositionType(sender.Selection.ActivePosition) == CellPositionType.Scrollable)
//{
// selCornerPos = sender.PositionAtPoint(new Point(e.X, e.Y));
// selCorner = sender.GetCell(pointPosition);
//}
if (selCornerPos.IsEmpty() == false && selCorner != null)
{
//Only if the user start the selection with a cell (m_MouseDownCell!=null)
if (sender.MouseDownPosition.IsEmpty() == false && sender.Selection.IsSelectedCell(sender.MouseDownPosition))
{
sender.ChangeMouseSelectionCorner(selCornerPos);
//sender.ShowCell(l_SelCornerPos);
}
}
}
}
}
示例7: Draw
public override void Draw(RangePaintEventArgs e)
{
RangeRegion region = mSelection.GetSelectionRegion();
if (region.IsEmpty())
return;
// get visible range for scrollable area
// AlanP: June 2014. Changed the call from RangeAtAreaExpanded to RangeAtArea to fix a bug that occurred on Partner/Find screen
// The grid on this screen has 3 fixed columns on the left but the highlight was always applied to the cell 'behind' the last fixed column
// as well as the rest of the row. This is because of getting the 'expanded' range.
// To be honest I don't understand what the expanded range is for. The comment for it is not helpful (to me anyway).
// It may be something to do with drawing the focus cell? If we see a problem later we could revies this code
//Range visibleScrollabeRange = mSelection.Grid.RangeAtAreaExpanded(CellPositionType.Scrollable);
Range visibleScrollableRange = mSelection.Grid.RangeAtArea(CellPositionType.Scrollable);
System.Drawing.Brush brush = e.GraphicsCache.BrushsCache.GetBrush(mSelection.BackColor);
// In OP we would like to have the rows of fixed columns highlighted as well - this seems non-standard
// This code is the same as is used in the standard code below, but for the FixedLeft Range
Range visibleFixedLeftRange = mSelection.Grid.RangeAtArea(CellPositionType.FixedLeft);
foreach (Range rangeToLoop in region)
{
Range rng = visibleFixedLeftRange.Intersect(rangeToLoop);
System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
if (rectToDraw == System.Drawing.Rectangle.Empty)
continue;
System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);
e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);
}
// Deal with the focus rectangle... The original grid code does not seem to support the focus being on a fixed column, which seems like a bug
// but does not affect OpenPetra
CellContext focusContext = new CellContext(e.Grid, mSelection.ActivePosition);
// get focus rectangle
// clipped to visible range
Range focusClippedRange = visibleScrollableRange.Intersect(new Range(mSelection.ActivePosition, mSelection.ActivePosition));
System.Drawing.Rectangle focusRect = e.Grid.PositionToRectangle(focusClippedRange.Start);
//Draw each selection range
foreach (Range rangeToLoop in region)
{
// intersect given range with visible range
// this way we ensure we don't loop through thousands
// of rows to calculate rectToDraw
Range rng = visibleScrollableRange.Intersect(rangeToLoop);
System.Drawing.Rectangle rectToDraw = e.Grid.RangeToRectangle(rng);
if (rectToDraw == System.Drawing.Rectangle.Empty)
continue;
System.Drawing.Region regionToDraw = new System.Drawing.Region(rectToDraw);
if (rectToDraw.IntersectsWith(focusRect))
regionToDraw.Exclude(focusRect);
e.GraphicsCache.Graphics.FillRegion(brush, regionToDraw);
//Draw the border only if there isn't a editing cell
// and is the range that contains the focus or there is a single range
if (rng.Contains(mSelection.ActivePosition) || region.Count == 1)
{
if (focusContext.IsEditing() == false)
mSelection.Border.Draw(e.GraphicsCache, rectToDraw);
}
}
//Draw Focus
System.Drawing.Brush brushFocus = e.GraphicsCache.BrushsCache.GetBrush(mSelection.FocusBackColor);
e.GraphicsCache.Graphics.FillRectangle(brushFocus, focusRect);
}