由于这是我一直,它其实整个问题就来了自己的第三次,我想,我应该在博客我的答复,以帮助未来的用户。问题描述
{A1}库。您添加一个关闭按钮来关闭应用程序的色带。在关闭应用程序崩溃。你坐在不切分支
问题是,你试图调用ribbon.DestroyFramework,最终从一个带状的命令处理程序调用IUIFramework.Destroy。因此,同时处理色带事件,你试图杀死剪彩。这是唯一公平的色带控制还击..解决方案
要么异步调用Close()方法:void _exitButton_OnExecute(
PropertyKeyRef key,
PropVariantRef currentValue,
IUISimplePropertySet commandExecutionProperties)
{
// Close form asynchronously since we are in a ribbon event
// handler, so the ribbon is still in use, and calling Close
// will eventually call _ribbon.DestroyFramework(), which is
// a big no-no, if you still use the ribbon.
this.BeginInvoke(new MethodInvoker(this.Close));
}
或不叫DestroyFramework时关闭应用程序(释放资源和信任窗口)。
[顺便说一下,C溶液是简单地调用PostMessage的,而不是SendMessage的(WM_CLOSE)(WM_CLOSE)]
我更新的{A2} 04 - TabGroupHelp样本,使其具有真正的退出按钮关闭表单上的色带。
这是现在,阿里克Poznanski。