本文整理汇总了C#中System.Windows.Controls.InkCanvas类的典型用法代码示例。如果您正苦于以下问题:C# InkCanvas类的具体用法?C# InkCanvas怎么用?C# InkCanvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InkCanvas类属于System.Windows.Controls命名空间,在下文中一共展示了InkCanvas类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InkCanvasAnnotation
private InkCanvasAnnotation(
Point textLocation,
InkCanvas InkCanvas)
{
if (InkCanvas == null)
throw new ArgumentNullException("InkCanvas");
_InkCanvas = InkCanvas;
this.HookInkCanvasEvents(true);
Size InkCanvasSize = _InkCanvas.RenderSize;
if (InkCanvasSize.Height == 0 || InkCanvasSize.Width == 0)
throw new ArgumentException("InkCanvas has invalid dimensions");
// Determine the relative location of the TextBlock.
_horizPercent = textLocation.X / InkCanvasSize.Width;
_vertPercent = textLocation.Y / InkCanvasSize.Height;
// Create the adorner which displays the annotation.
_adorner = new InkCanvasAnnotationAdorner(
this,
_InkCanvas,
textLocation);
this.InstallAdorner();
}
示例2: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.inkBoard = ((System.Windows.Controls.InkCanvas)(target));
#line 11 "..\..\SurfaceWindow1.xaml"
this.inkBoard.AddHandler(Microsoft.Surface.Presentation.Contacts.PreviewContactDownEvent, new Microsoft.Surface.Presentation.ContactEventHandler(this.onContactDown));
#line default
#line hidden
#line 11 "..\..\SurfaceWindow1.xaml"
this.inkBoard.AddHandler(Microsoft.Surface.Presentation.Contacts.PreviewContactUpEvent, new Microsoft.Surface.Presentation.ContactEventHandler(this.onContactUp));
#line default
#line hidden
#line 12 "..\..\SurfaceWindow1.xaml"
this.inkBoard.AddHandler(Microsoft.Surface.Presentation.Contacts.PreviewContactChangedEvent, new Microsoft.Surface.Presentation.ContactEventHandler(this.onContactDown));
#line default
#line hidden
return;
case 2:
this.iCapturedFrame = ((System.Windows.Controls.Image)(target));
return;
}
this._contentLoaded = true;
}
示例3: OnMouseMove
public override void OnMouseMove(InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
endPoint = e.GetPosition(inkCanvas);
if (startPoint != endPoint)
{
StylusPointCollection pts = new StylusPointCollection();
GetLine(pts, (s) =>
{
if (StrokeResult != null)
inkCanvas.Strokes.Remove(StrokeResult);
DrawingAttributes drawingAttributes = new DrawingAttributes
{
Color = inkCanvas.DefaultDrawingAttributes.Color,
Width = inkCanvas.DefaultDrawingAttributes.Width,
StylusTip = StylusTip.Ellipse,
IgnorePressure = true,
FitToCurve = true
};
StrokeResult = new ArrowLineStroke(s, drawingAttributes);
inkCanvas.Strokes.Add(StrokeResult);
}
);
}
}
}
示例4: AddControl
protected static void AddControl(IDiagram buttonHolder, InkCanvas parentControl)
{
var ret = new FlexButton.FlexButton { DataContext = buttonHolder, ContextMenu = ButtonContextMenu };
ret.CommandParameter = buttonHolder;
parentControl.Children.Add(ret);
var heightBinding = new Binding("Height") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var widthBinding = new Binding("Width") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var xBinding = new Binding("X") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var yBinding = new Binding("Y") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var captionBinding = new Binding("Caption") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var radiusBinding = new Binding("CornerRadius") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var buttonColorBinding = new Binding("ButtonColor") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var commandBinding = new Binding("Command") { Source = buttonHolder, Mode = BindingMode.OneWay };
var enabledBinding = new Binding("IsEnabled") { Source = buttonHolder, Mode = BindingMode.OneWay };
var transformBinding = new Binding("RenderTransform") { Source = buttonHolder, Mode = BindingMode.OneWay };
ret.SetBinding(LeftProperty, xBinding);
ret.SetBinding(TopProperty, yBinding);
ret.SetBinding(HeightProperty, heightBinding);
ret.SetBinding(WidthProperty, widthBinding);
ret.SetBinding(ContentControl.ContentProperty, captionBinding);
ret.SetBinding(FlexButton.FlexButton.CornerRadiusProperty, radiusBinding);
ret.SetBinding(FlexButton.FlexButton.ButtonColorProperty, buttonColorBinding);
ret.SetBinding(ButtonBase.CommandProperty, commandBinding);
ret.SetBinding(RenderTransformProperty, transformBinding);
ret.SetBinding(IsEnabledProperty, enabledBinding);
}
示例5: CreateStackMoveDelta
public void CreateStackMoveDelta()
{
var canvas = new InkCanvas();
var contentBuffer = new ContentBuffer();
var moveDeltaProcessor = new StackMoveDeltaProcessor(canvas, contentBuffer, "presentationSpace");
}
示例6: VisualizeAnswerSheetComparison
/// <summary>
/// Visualize answer sheet comparison
/// </summary>
/// <param name="filePath1">Path to answer 1 file</param>
/// <param name="filePath2">Path to answer 2 file</param>
/// <param name="inkCanvas1">Stroke drawing canvas of answer 1</param>
/// <param name="inkCanvas2">Stroke drawing canvas of answer 2</param>
/// <param name="graphCanvas">Answer step graph drawing canvas</param>
/// <param name="colorAnswerSteps">Color strokes by each answer step</param>
public void VisualizeAnswerSheetComparison(string filePath1, string filePath2, InkCanvas inkCanvas1, InkCanvas inkCanvas2, Canvas graphCanvas,
bool colorAnswerSteps = false)
{
List<AnalysisPenStroke> strokes1 = this.analyzer.LoadStrokesFromFile(filePath1);
List<AnalysisPenStroke> strokes2 = this.analyzer.LoadStrokesFromFile(filePath2);
inkCanvas1.Strokes.Clear();
inkCanvas2.Strokes.Clear();
graphCanvas.Children.Clear();
List<AnswerStep> ansGroupList1 = this.analyzer.GroupAnswerStep(strokes1);
List<AnswerStep> ansGroupList2 = this.analyzer.GroupAnswerStep(strokes2);
if (colorAnswerSteps)
{
ColorAnswerGroupStrokes(ansGroupList1, inkCanvas1);
ColorAnswerGroupStrokes(ansGroupList2, inkCanvas2);
}
else
{
ColorAnswerGroupStrokes(ansGroupList1, inkCanvas1, true);
ColorAnswerGroupStrokes(ansGroupList2, inkCanvas2, true);
}
VisualizeAnswerGroupBoundingBox(ansGroupList1, graphCanvas);
VisualizeAnswerGroupBoundingBox(ansGroupList2, graphCanvas, new Point(Config.OutputCanvasWidth, 0));
DPMatchingResult matchingResult = this.analyzer.CalcAnswerProcessSimilarity(ansGroupList1, ansGroupList2);
VisualizeMatchingResult(ansGroupList1, ansGroupList2, matchingResult, graphCanvas, new Point(Config.OutputCanvasWidth, 0));
}
示例7: OnMouseMove
public override void OnMouseMove(InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
var p = e.GetPosition(inkCanvas);
if (p != point)
{
point = p;
GetBrush(pts, (s) =>
{
if (StrokeResult != null)
inkCanvas.Strokes.Remove(StrokeResult);
DrawingAttributes drawingAttributes = new DrawingAttributes
{
Color = inkCanvas.DefaultDrawingAttributes.Color,
Width = inkCanvas.DefaultDrawingAttributes.Width,
StylusTip = StylusTip.Ellipse,
IgnorePressure = true,
FitToCurve = true
};
StrokeResult = new BrushStroke(s, drawingAttributes);
inkCanvas.Strokes.Add(StrokeResult);
}
);
}
}
}
示例8: VisualizeAnswerSheet
/// <summary>
/// Visualize answer sheet
/// </summary>
/// <param name="filePath">Path to answer data file</param>
/// <param name="inkCanvas">Stroke drawing canvas</param>
/// <param name="answerStepGraphCanvas">Answer step graph drawing canvas</param>
/// <param name="showAnswerStepGraph">Draw answer step graph</param>
/// <param name="colorAnswerSteps">Color strokes by each answer step</param>
/// <param name="showAnswerStepBox">Draw bounding box of answer step</param>
public void VisualizeAnswerSheet(string filePath, InkCanvas inkCanvas, Canvas answerStepGraphCanvas,
bool showAnswerStepGraph = false,
bool colorAnswerSteps = false,
bool showAnswerStepBox = false)
{
List<AnalysisPenStroke> strokes = this.analyzer.LoadStrokesFromFile(filePath);
inkCanvas.Strokes.Clear();
answerStepGraphCanvas.Children.Clear();
List<AnswerStep> ansGroupList = this.analyzer.GroupAnswerStep(strokes);
if (colorAnswerSteps)
{
ColorAnswerGroupStrokes(ansGroupList, inkCanvas);
}
else
{
ColorAnswerGroupStrokes(ansGroupList, inkCanvas, true);
}
if (showAnswerStepBox)
{
VisualizeAnswerGroupBoundingBox(ansGroupList, answerStepGraphCanvas);
}
if (showAnswerStepGraph)
{
DrawAnswerGroupGraph(ansGroupList, answerStepGraphCanvas);
}
}
示例9: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.myInkCanvas = ((System.Windows.Controls.InkCanvas)(target));
#line 8 "..\..\Window1.xaml"
this.myInkCanvas.Gesture += new System.Windows.Controls.InkCanvasGestureEventHandler(this.OnGesture);
#line default
#line hidden
#line 8 "..\..\Window1.xaml"
this.myInkCanvas.Loaded += new System.Windows.RoutedEventHandler(this.onLoaded);
#line default
#line hidden
#line 8 "..\..\Window1.xaml"
this.myInkCanvas.StrokeCollected += new System.Windows.Controls.InkCanvasStrokeCollectedEventHandler(this.onStrokeCollected);
#line default
#line hidden
#line 8 "..\..\Window1.xaml"
this.myInkCanvas.StrokeErasing += new System.Windows.Controls.InkCanvasStrokeErasingEventHandler(this.onStrokeErasing);
#line default
#line hidden
return;
}
this._contentLoaded = true;
}
示例10: Draw
//В конструкторе осуществляется настройка параметров InkCanvas
public Draw(InkCanvas surface)
{
this.Surface = surface;
Surface.EditingMode = InkCanvasEditingMode.None;
Surface.UseCustomCursor = true;
Surface.Cursor = Cursors.Arrow;
}
示例11: DrawingCanvasHelper
// REFACTOR THIS TO A STATIC CLASS
public DrawingCanvasHelper(SessionManager _activeSessionManager, InkCanvas _PageInkCanvas, ScatterView _Container, Ellipse _CurrentColor, Image _ColorWheel)
{
this.ActiveSessionManager = _activeSessionManager;
this.PageInkCanvas = _PageInkCanvas;
this.Container = _Container;
this.CurrentColor = _CurrentColor;
this.ColorWheel = _ColorWheel;
}
示例12: LoadImage
public static void LoadImage(InkCanvas inkCanvas)
{
var image = LoadImage();
if (image != null)
{
inkCanvas.Children.Add(image);
}
}
示例13: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.canvas1 = ((System.Windows.Controls.InkCanvas)(target));
return;
}
this._contentLoaded = true;
}
示例14: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
canvas = GetTemplateChild("Canvas") as InkCanvas;
paintButton = GetTemplateChild("PaintBtn") as Button;
clearButton = GetTemplateChild("ClearBtn") as Button;
paintButton.Click += PaintButtonOnClick;
clearButton.Click += ClearButtonOnClick;
}
示例15: ApplyTextModifications
public static void ApplyTextModifications(Text txt, InkCanvas canvas)
{
txt.TextContent = txt.TextContent.ToUpper();
txt.TextSize = 72;
txt.FontWeight = FontWeights.Bold;
Text.SetTxtWidthAndHeight(txt);
var position = canvas.CanvasTopCenterCoordinates(txt.Width, txt.Height);
canvas.SetObjectPositionOnCanvas(txt, position.X, position.Y);
}