本文整理汇总了C#中GridVirtual类的典型用法代码示例。如果您正苦于以下问题:C# GridVirtual类的具体用法?C# GridVirtual怎么用?C# GridVirtual使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GridVirtual类属于命名空间,在下文中一共展示了GridVirtual类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: grid_MouseDown
protected virtual void grid_MouseDown(GridVirtual sender, MouseEventArgs e)
{
#warning da fare
//if (sender.Selection.BorderRange.IsEmpty() == false)
//{
// Position mousePos = sender.PositionAtPoint(new System.Drawing.Point(e.X, e.Y));
// if (mousePos.IsEmpty() == false)
// {
// 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.BottomBorder ||
// partType == DevAge.Drawing.RectanglePartType.TopBorder ||
// partType == DevAge.Drawing.RectanglePartType.RightBorder ||
// partType == DevAge.Drawing.RectanglePartType.LeftBorder)
// {
// RangeData data = new RangeData();
// data.LoadData(sender, sender.Selection.BorderRange, mousePos, mCutMode);
// if (mCutMode == CutMode.None)
// sender.DoDragDrop(data, DragDropEffects.Copy);
// else
// sender.DoDragDrop(data, DragDropEffects.Move);
// }
// }
//}
}
示例3: OnDetach
protected override void OnDetach(GridVirtual grid)
{
grid.DragEnter -= new GridDragEventHandler(grid_DragEnter);
grid.DragLeave -= new GridEventHandler(grid_DragLeave);
grid.DragDrop -= new GridDragEventHandler(grid_DragDrop);
grid.DragOver -= new GridDragEventHandler(grid_DragOver);
}
示例4: BindToGrid
public override void BindToGrid(GridVirtual p_grid)
{
base.BindToGrid(p_grid);
mDecorator = new Decorators.DecoratorSelection(this);
Grid.Decorators.Add(mDecorator);
}
示例5: Export
public virtual void Export(GridVirtual grid, System.Drawing.Graphics graphics,
Range rangeToExport, System.Drawing.Point destinationLocation)
{
if (rangeToExport.IsEmpty())
return;
System.Drawing.Point cellPoint = destinationLocation;
System.Drawing.Point deltaPoint = destinationLocation;
using (DevAge.Drawing.GraphicsCache graphicsCache = new DevAge.Drawing.GraphicsCache(graphics))
{
for (int r = rangeToExport.Start.Row; r <= rangeToExport.End.Row; r++)
{
int rowHeight = grid.Rows.GetHeight(r);
for (int c = rangeToExport.Start.Column; c <= rangeToExport.End.Column; c++)
{
Rectangle cellRectangle;
Position pos = new Position(r, c);
Size cellSize = new Size(grid.Columns.GetWidth(c), rowHeight);
Range range = grid.PositionToCellRange(pos);
//support for RowSpan or ColSpan
//Note: for now I draw only the merged cell at the first position
// (this can cause a problem if you export partial range that contains a partial merged cells)
if ( range.ColumnsCount > 1 || range.RowsCount > 1)
{
//Is the first position
if (range.Start == pos)
{
Size rangeSize = grid.RangeToSize(range);
cellRectangle = new Rectangle(cellPoint,
rangeSize);
}
else
cellRectangle = Rectangle.Empty;
}
else
{
cellRectangle = new Rectangle(cellPoint, cellSize);
}
if (cellRectangle.IsEmpty == false)
{
Cells.ICellVirtual cell = grid.GetCell(pos);
CellContext context = new CellContext(grid, pos, cell);
ExportCell(context, graphicsCache, cellRectangle);
}
cellPoint = new Point(cellPoint.X + cellSize.Width, cellPoint.Y);
}
cellPoint = new Point(destinationLocation.X, cellPoint.Y + rowHeight);
}
}
}
示例6: Export
public virtual System.Drawing.Bitmap Export(GridVirtual grid, Range rangeToExport)
{
System.Drawing.Bitmap bitmap = null;
try
{
System.Drawing.Size size = grid.RangeToSize(rangeToExport);
bitmap = new System.Drawing.Bitmap(size.Width, size.Height);
using (System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(bitmap))
{
Export(grid, graphic, rangeToExport, new System.Drawing.Point(0, 0));
}
}
catch (Exception)
{
if (bitmap != null)
{
bitmap.Dispose();
bitmap = null;
}
throw;
}
return bitmap;
}
示例7: OnDetach
protected override void OnDetach(GridVirtual grid)
{
grid.MouseDown -= new GridMouseEventHandler(grid_MouseDown);
grid.MouseUp -= new GridMouseEventHandler(grid_MouseUp);
grid.MouseMove -= new GridMouseEventHandler(grid_MouseMove);
grid.MouseLeave -= new GridEventHandler(grid_MouseLeave);
}
示例8: OnDetach
protected override void OnDetach(GridVirtual grid)
{
grid.MouseMove -= new GridMouseEventHandler(grid_MouseMove);
grid.MouseLeave -= new GridEventHandler(grid_MouseLeave);
grid.MouseDown -= new GridMouseEventHandler(grid_MouseDown);
grid.GiveFeedback -= new GridGiveFeedbackEventHandler(grid_GiveFeedback);
}
示例9: AttachControl
/// <summary>
/// Add the Control to the specified grid. Consider that a Control can only be a child of one Container.
/// </summary>
private void AttachControl(GridVirtual grid)
{
mGrid = grid;
mLinkedControl = new LinkedControlValue(Control, Position.Empty);
Control.Hide();
grid.LinkedControls.Add(mLinkedControl);
Control.Validated += new EventHandler(InnerControl_Validated);
Control.KeyPress += new KeyPressEventHandler(InnerControl_KeyPress);
}
示例10: GridPrintDocument
public GridPrintDocument(GridVirtual grid)
{
m_Grid = grid;
// Default to empty background
m_CellPrintView.BackColor = Color.Empty;
m_HeaderCellPrintView.BackColor = Color.Empty;
m_PageHeaderFont = new Font(grid.Font, FontStyle.Regular);
m_PageTitleFont = new Font(grid.Font, FontStyle.Bold);
m_PageFooterFont = new Font(grid.Font, FontStyle.Regular);
}
示例11: grid_MouseUp
protected virtual void grid_MouseUp(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
{
if (sender.MouseDownPosition.IsEmpty() == false)
{
Cells.ICellVirtual l_MouseDownCell = sender.GetCell(sender.MouseDownPosition);
if (l_MouseDownCell!=null)
sender.Controller.OnMouseUp(new CellContext(sender, sender.MouseDownPosition, l_MouseDownCell), e );
sender.ChangeMouseDownCell(Position.Empty, sender.PositionAtPoint(new Point(e.X, e.Y)));
}
}
示例12: grid_KeyDown
private void grid_KeyDown(GridVirtual sender, KeyEventArgs e)
{
if (e.Handled)
return;
if (sender.Selection.IsEmpty())
return;
if (e.KeyCode == Keys.Delete)
{
sender.ClearValues(sender.Selection.GetSelectionRegion());
e.Handled = true;
}
}
示例13: 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);
// }
// }
// }
//}
}
示例14: grid_KeyDown
private void grid_KeyDown(GridVirtual sender, KeyEventArgs e)
{
if (e.Handled)
return;
#warning da fare
//Range rng = sender.Selection.BorderRange;
//if (rng.IsEmpty())
// return;
////Paste
//if (e.Control && e.KeyCode == Keys.V && PasteEnabled)
//{
// RangeData rngData = RangeData.ClipboardGetData();
// if (rngData != null)
// {
// Range destinationRange = rngData.FindDestinationRange(sender, rng.Start);
// if (ExpandSelection == false)
// destinationRange = destinationRange.Intersect(rng);
// rngData.WriteData(sender, destinationRange);
// e.Handled = true;
// sender.Selection.Clear();
// sender.Selection.Add(destinationRange);
// }
//}
////Copy
//else if (e.Control && e.KeyCode == Keys.C && CopyEnabled)
//{
// RangeData data = new RangeData();
// data.LoadData(sender, rng, rng.Start, CutMode.None);
// RangeData.ClipboardSetData(data);
// e.Handled = true;
//}
////Cut
//else if (e.Control && e.KeyCode == Keys.X && CutEnabled)
//{
// RangeData data = new RangeData();
// data.LoadData(sender, rng, rng.Start, CutMode.CutImmediately);
// RangeData.ClipboardSetData(data);
// e.Handled = true;
//}
}
示例15: grid_MouseMove
protected virtual void grid_MouseMove(GridVirtual sender, MouseEventArgs e)
{
#warning da fare
//if (sender.Selection.BorderRange.IsEmpty() == false)
//{
// 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.BottomBorder ||
// partType == DevAge.Drawing.RectanglePartType.TopBorder ||
// partType == DevAge.Drawing.RectanglePartType.RightBorder ||
// partType == DevAge.Drawing.RectanglePartType.LeftBorder)
// mDragCursor.ApplyCursor(sender);
// else
// mDragCursor.ResetCursor();
//}
}