3

Windows 8 Metro 风格项目。

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

抛出异常

对 COM 组件的调用已返回错误 HRESULT E_FAIL。”

4

1 回答 1

0
    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();
        }
    }
于 2013-04-09T10:57:28.453 回答