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/