补充说明:
此问题已经在新版本中解决(15.2.6),方法更加简单,只需要在 MDIChild 窗体的 Create 方法中,将 Ribbon 的 Visible 属性设置为 false 就可以了,且无刷新。
----------------------------------------------------------------------------------------------------
以下为历史的解决方案
----------------------------------------------------------------------------------------------------
当 MDI 主窗体和子窗体都有 Ribbon ,且使用了 TabbedMDIManager 以 Tab 页的形式显示子窗体,在切换子窗体时,会在客户区闪现 ribbon 工具条。
查 DevExpress 网站,解决办法如下:
1、主窗体使用 TRibbonForm。
主窗体创建子窗体时示例代码如下
function TMainForm.CreateScriptEditorTab(pCaption: string): TScriptEditorTabSheet;
var
tabSheet: TScriptEditorTabSheet;
se: TScriptEditor;
begin
Ribbon.BeginUpdate;
BarManager.BeginUpdate;
se := TScriptEditor.Create(Application, Self);
BarManager.EndUpdate();
ribbon.EndUpdate;
end;
2、子窗体使用普通 TForm。
type
TScriptEditor = class(TForm)
BarManager: TdxBarManager;
RibbonTab_Start: TdxRibbonTab;
Ribbon: TdxRibbon;
BarManagerBar1: TdxBar;
menuItem_ExecuteScript: TdxBarLargeButton;
QueryEditor: TQueryEditor;
procedure FormActivate(Sender: TObject);
procedure menuItem_ExecuteScriptClick(Sender: TObject);
private
Framework: IFramework;
public
constructor Create(AOwner: TComponent; pFramework: IFramework); overload;
procedure UpdateRibbonMessage(var Message: TMessage);message UM_CHILD_RIBBON_MESSAGE;
end;
implementation
{$R *.dfm}
{ TScriptEditor }
constructor TScriptEditor.Create(AOwner: TComponent; pFramework: IFramework);
begin
inherited Create(AOwner);
Framework := pFramework;
end;
procedure TScriptEditor.FormActivate(Sender: TObject);
begin
Framework.RibbonObject.BeginUpdate;
PostMessage(Handle, UM_CHILD_RIBBON_MESSAGE, 0, 0);
end;
procedure TScriptEditor.menuItem_ExecuteScriptClick(Sender: TObject);
begin
QueryEditor.Execute;
end;
procedure TScriptEditor.UpdateRibbonMessage(var Message: TMessage);
begin
Framework.RibbonObject.EndUpdate;
end;
end.