当前位置: 首页>>代码示例>>C#>>正文


C# Controls.InkCanvas类代码示例

本文整理汇总了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();
        }
开发者ID:randomgeekdom,项目名称:StorySuite,代码行数:26,代码来源:InkCanvasAnnotationDemo.cs

示例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;
 }
开发者ID:aurelient,项目名称:AndreaInternship,代码行数:30,代码来源:SurfaceWindow1.g.cs

示例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);
                    }
                    );
                }
            }
        }
开发者ID:sonicrang,项目名称:RangPaint,代码行数:30,代码来源:DrawArrowLine.cs

示例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);
        }
开发者ID:betology,项目名称:SambaPOS-3,代码行数:28,代码来源:DiagramCanvas.cs

示例5: CreateStackMoveDelta

        public void CreateStackMoveDelta()
        {
            var canvas = new InkCanvas();
            var contentBuffer = new ContentBuffer();

            var moveDeltaProcessor = new StackMoveDeltaProcessor(canvas, contentBuffer, "presentationSpace");
        }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:7,代码来源:MoveDeltaProcessorTest.cs

示例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));
        }
开发者ID:h-asai,项目名称:AnswersheetAnalysis,代码行数:40,代码来源:AnswerSheetVisualizer.cs

示例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);
                    }
                   );
                }
            }
        }
开发者ID:sonicrang,项目名称:RangPaint,代码行数:29,代码来源:DrawBrush.cs

示例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);
            }
        }
开发者ID:h-asai,项目名称:AnswersheetAnalysis,代码行数:37,代码来源:AnswerSheetVisualizer.cs

示例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;
 }
开发者ID:Ceasar,项目名称:InkAnalysis,代码行数:33,代码来源:Window1.g.cs

示例10: Draw

 //В конструкторе осуществляется настройка параметров InkCanvas
 public Draw(InkCanvas surface)
 {
     this.Surface = surface;
     Surface.EditingMode = InkCanvasEditingMode.None;
     Surface.UseCustomCursor = true;
     Surface.Cursor = Cursors.Arrow;
 }
开发者ID:Optofizik,项目名称:Graphic-Editor,代码行数:8,代码来源:Draw.cs

示例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;
 }
开发者ID:tuliosouza,项目名称:ASG,代码行数:9,代码来源:DrawingCanvasHelper.cs

示例12: LoadImage

 public static void LoadImage(InkCanvas inkCanvas)
 {
     var image = LoadImage();
     if (image != null)
     {
         inkCanvas.Children.Add(image);
     }
 }
开发者ID:CuteITGuy,项目名称:ProgrammerUtilitiesCOOL,代码行数:8,代码来源:ImageFileHander.cs

示例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;
 }
开发者ID:fm107,项目名称:Shared,代码行数:9,代码来源:MainWindow.g.cs

示例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;
 }
开发者ID:hinduCoder,项目名称:Diploma,代码行数:9,代码来源:DrawerControl.cs

示例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);
 }
开发者ID:undecimus,项目名称:komunikator,代码行数:10,代码来源:ObjectPositionOnSlide.cs


注:本文中的System.Windows.Controls.InkCanvas类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。