• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.InkCanvas类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Controls.InkCanvas的典型用法代码示例。如果您正苦于以下问题:C# InkCanvas类的具体用法?C# InkCanvas怎么用?C# InkCanvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InkCanvas类属于System.Windows.Controls命名空间,在下文中一共展示了InkCanvas类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: SelectAdorner

        public SelectAdorner(InkCanvas inkCanvas, Point? dragStartPoint)
            : base(inkCanvas)
        {
            this.inkCanvas = inkCanvas;
            this.startPoint = dragStartPoint;
            this.endPoint = Mouse.GetPosition(inkCanvas);

            pen = new Pen(Brushes.LightSlateGray, 1);
            pen.DashStyle = new DashStyle(new double[] { 2 }, 1);
        }
开发者ID:sonicrang,项目名称:RangPaint,代码行数:10,代码来源:SelectAdorner.cs


示例17: Recompose

        //will probably make this multiple canvases
        public void Recompose(InkCanvas inkCanvas)
        {
            this.inkCanvas = inkCanvas;

            timer = new DispatcherTimer();
            CreateStroke();
            timer.Interval = new TimeSpan(0, 0, 0, 0, 10);
            timer.Tick += Timer_Tick;
            timer.Start();
        }
开发者ID:tonyhallett,项目名称:AlarmClock,代码行数:11,代码来源:StrokeRecomposer.cs


示例18: TouchRecognizeAutomata

        public TouchRecognizeAutomata(InkCanvas canvas)
        {
            _Canvas = canvas;

            _modeRecognizer = new TouchModeRecognizer(canvas);
            _modeRecognizer.IsEnableCollect = true;

            canvas.PreviewTouchDown += new EventHandler<TouchEventArgs>(canvas_PreviewTouchDown);
            canvas.PreviewTouchMove += new EventHandler<TouchEventArgs>(canvas_PreviewTouchMove);
            canvas.PreviewTouchUp += new EventHandler<TouchEventArgs>(canvas_PreviewTouchUp);
        }
开发者ID:habs57,项目名称:tablet-interaction,代码行数:11,代码来源:TouchRecognizeAutomata.cs


示例19: InkCanvasSelection

        //-------------------------------------------------------------------------------
        //
        // Constructors
        //
        //-------------------------------------------------------------------------------

        #region Constructors

        /// <summary>
        /// InkCanvasSelection has an internal constructor to prevent direct instantiation
        /// </summary>
        /// <param name="inkCanvas">inkCanvas</param>
        internal InkCanvasSelection(InkCanvas inkCanvas)
        {
            //validate
            if (inkCanvas == null)
            {
                throw new ArgumentNullException("inkCanvas");
            }
            _inkCanvas = inkCanvas;

            _inkCanvas.FeedbackAdorner.UpdateBounds(Rect.Empty);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:23,代码来源:InkCanvasSelection.cs


示例20: btnClear_Click

 //private void InkCanvas_MouseDown(object sender, MouseButtonEventArgs e)
 //{
 //    if (e.ButtonState == MouseButtonState.Pressed)
 //        currentPoint = e.GetPosition(this);
 //    if (_shape == "arrow")
 //    {
 //        _startPoint = e.GetPosition(this);
 //    }
 //}
 private void btnClear_Click(object sender, RoutedEventArgs e)
 {
     cvs.Children.Clear();
     InkCanvas inkCanvas = new InkCanvas();
     inkCanvas.Name = "InkCanvas";
     inkCanvas.Background = Brushes.White;
     inkCanvas.Opacity = .01;
     inkCanvas.Height = System.Windows.SystemParameters.PrimaryScreenHeight;
     inkCanvas.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
     Mouse.OverrideCursor = Cursors.Arrow;
     cvs.Children.Add(inkCanvas);
 }
开发者ID:mtintes,项目名称:ClearDraw,代码行数:21,代码来源:MainWindow.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WebControls.CommandEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Controls.Image类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap