替代 InkPresenter? [英] Alternative to InkPresenter?

查看:20
本文介绍了替代 InkPresenter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 8 中有一个基于手写的应用程序.我正在尝试将其移植到 Windows Phone 8.但只有 3 个 Inking 类可用于 WP8 而没有 Inkmanager 类.我们可以使用画布代替 InkPresenter.中风的所有功能都可以使用吗?我尝试了以下代码

I have an app in Windows 8 which is a hand writing based. Im trying to port it to Windows Phone 8. But there are only 3 Inking classes available for WP8 and no Inkmanager class. Can we use a canvas instead of InkPresenter. Are all functions of stroke available for it. I tried the following code

private void MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
        InkCanvas.CaptureMouse();
        StylusPointCollection MyStylusPointCollection = new StylusPointCollection();
        MyStylusPointCollection.Add(e.StylusDevice.GetStylusPoints(InkCanvas));
        NewStroke = new Stroke(MyStylusPointCollection);
        //InkCanvas.Strokes.Add(NewStroke);
        NewStroke.DrawingAttributes = SetAttributes(draw);
    }

最后一行有一个错误,它说画布不包含笔画的定义.InkPresenter 不适合我的需要.如果不是画布,是否还有其他元素可以捕获触摸输入?

There is an error in the second last line it says, canvas does not contain the definition for strokes. InkPresenter does not suit my needs. If not canvas is there any other element which can capture the touch input?

推荐答案

感谢您的回答,Inkpresenter 不能满足我的需求.所以我使用了画布和触摸输入.对于那些正在寻找线索的人......

Thanks for your answer, The Inkpresenter does not meet my needs. So I have used the canvas and touch input. For those of you who are looking for clues...

我已经使用了 Touch_FrameReported 和这样的基本线条绘制

I have made use Touch_FrameReported and basic line drawing like this

            if (pointCollection[i].Action == TouchAction.Move)
            {
                Line line = new Line();

                line.X1 = preXArray[i];
                line.Y1 = preYArray[i];
                line.X2 = pointCollection[i].Position.X;
                line.Y2 = pointCollection[i].Position.Y;

                line.Stroke = new SolidColorBrush(Colors.Black);
                line.Fill = new SolidColorBrush(Colors.Black);
                line.StrokeThickness = 15;
                line.StrokeDashCap = PenLineCap.Round;
                line.StrokeStartLineCap = PenLineCap.Round;
                line.StrokeEndLineCap = PenLineCap.Round;

                drawCanvas.Children.Add(line);                  

这篇关于替代 InkPresenter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆