c# - Windows 8 Metro 风格项目(InkStroke.Add 错误)

标签 c# microsoft-metro

Windows 8 Metro 风格项目。

删除一些笔画后,我尝试使用 InkManager.AddStroke() 方法添加删除的笔画以提供撤消和重做功能。

抛出异常

Error HRESULT E_FAIL has been returned from a call to a COM component."

最佳答案

    public void OnDrawUndo(object sender, RoutedEventArgs e)
    {
        try
        {
            BackupInkStrokeCollection.Push(CurrentInkStrokeCollection.Pop());
            renderer.Clear();
            renderer.AddInk(CurrentInkStrokeCollection);

            //inkManager.GetStrokes()[inkManager.GetStrokes().Count - 1].Selected = true;

            InkStroke SelectedStroke = inkManager.GetStrokes()[inkManager.GetStrokes().Count - 1];
            SelectedStroke.Selected = true;
            var MyInkManager = new InkManager();
            MyInkManager.AddStroke(SelectedStroke.Clone());
            MyInkManagers.Add(MyInkManager);
            inkManager.DeleteSelected();
        }
        catch (Exception ee)
        {
            if (ee.Message == "Stack empty.")
                return;
            else
                new Windows.UI.Popups.MessageDialog(ee.ToString()).ShowAsync();
        }
    }

关于c# - Windows 8 Metro 风格项目(InkStroke.Add 错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11312137/

相关文章:

c# - .Net core 2.0 控制台应用程序的日志记录和配置?

c# - 正则表达式生成

c# - 使用 .net 启动 Windows 服务开发

microsoft-metro - 为什么 Metro 应用程序不支持 MFCreateMediaSession?

windows-8 - 发现app已经更新了

xaml - 如何在 Windows 8 应用程序 C# 中将视频作为 Web UI 嵌入磁贴中

c# - 我无法从 C# 访问 mysql 数据库

c# - EF Code First 处理多对多关系

javascript - Windows 8 Metro 打开本地文件 (.html)

c# - 是否有可能在 C# Winforms 中使用 MetroUI?