76 lines
1.9 KiB
C#
76 lines
1.9 KiB
C#
![]() |
using System;
|
|||
|
using CPF.Drawing;
|
|||
|
using CPF.Input;
|
|||
|
using CPF.ReoGrid.Drawing;
|
|||
|
using CPF.ReoGrid.Interaction;
|
|||
|
using CPF.ReoGrid.Rendering;
|
|||
|
|
|||
|
namespace CPF.ReoGrid.Views
|
|||
|
{
|
|||
|
internal class DrawingViewport : Viewport
|
|||
|
{
|
|||
|
public DrawingViewport(IViewportController vc) : base(vc)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public override void DrawView(CellDrawingContext dc)
|
|||
|
{
|
|||
|
this.sheet.drawingCanvas.ClipBounds = this.ViewBounds;
|
|||
|
this.sheet.drawingCanvas.Draw(dc);
|
|||
|
}
|
|||
|
|
|||
|
public override void UpdateView()
|
|||
|
{
|
|||
|
base.UpdateView();
|
|||
|
this.sheet.drawingCanvas.ScaleX = this.scaleFactor;
|
|||
|
this.sheet.drawingCanvas.ScaleY = this.scaleFactor;
|
|||
|
}
|
|||
|
|
|||
|
public override IView GetViewByPoint(Point p)
|
|||
|
{
|
|||
|
WorksheetDrawingCanvas drawingCanvas = this.sheet.drawingCanvas;
|
|||
|
bool flag = drawingCanvas == null || drawingCanvas.Children == null || drawingCanvas.Children.Count <= 0;
|
|||
|
IView result;
|
|||
|
if (flag)
|
|||
|
{
|
|||
|
result = null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Point point = this.PointToView(p);
|
|||
|
for (int i = drawingCanvas.Children.Count - 1; i >= 0; i--)
|
|||
|
{
|
|||
|
IDrawingObject drawingObject = drawingCanvas.Children[i];
|
|||
|
bool flag2 = drawingObject.Bounds.Contains(point);
|
|||
|
if (flag2)
|
|||
|
{
|
|||
|
return this;
|
|||
|
}
|
|||
|
}
|
|||
|
result = null;
|
|||
|
}
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public override bool OnMouseDown(Point location, MouseButtons buttons, InputModifiers modifiers)
|
|||
|
{
|
|||
|
return this.sheet.drawingCanvas.OnMouseDown(location, buttons, modifiers);
|
|||
|
}
|
|||
|
|
|||
|
public override bool OnMouseMove(Point location, MouseButtons buttons)
|
|||
|
{
|
|||
|
return this.sheet.drawingCanvas.OnMouseMove(location, buttons);
|
|||
|
}
|
|||
|
|
|||
|
public override bool OnMouseUp(Point location, MouseButtons buttons, InputModifiers modifiers)
|
|||
|
{
|
|||
|
return this.sheet.drawingCanvas.OnMouseUp(location, buttons, modifiers);
|
|||
|
}
|
|||
|
|
|||
|
public override bool OnMouseDoubleClick(Point location, MouseButtons buttons)
|
|||
|
{
|
|||
|
return this.sheet.drawingCanvas.OnMouseDoubleClick(location, buttons);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|