首页  编辑  

非常怪的问题(关于MDI)

Tags: /超级猛料/VCL/Form,窗体/MDI界面窗体/   Date Created:

]、。·ˉˇ¨〃々—~‖…’”〕〉》」』〗】∶!"'),.:;?]` 来自Borland TeamC的办法:

 将forms.pas从BCB安装目录拷贝到你的BCB工程目录下,然后将这里提供的改动部分粘贴到源文件中去,同名函数要注释掉旧的;

 选择菜单Project->Options->Packages,关闭Build with runtime packages 选项(即不选中);

 选择菜单Project->Add to projects...,将拷贝的文件加入进工程;

 选择菜单Project->Build 你的工程即可(请先保存工程,因为有时Build后会兰屏,重运行BCB即可)。

注:

请注意版本说明,将此版本中改动的地方粘贴到你所用的版本的源代码中去调试(我不保证不同版本源代码可以互用);

此方法适用于任何你想改动源代码并且应用到现有的BCB中去的情况,比如汉化对话框文本(修改consts.pas);

我在源代码中做了改动的地方,注明了改动代码者的名字,多谢这些朋友们,无论国籍和地域。

如果你从这里获得启发,并且有其它对BCB源代码有价值的改动,能让我分享吗?

谢谢啦!

-------------------------

odin

StarSail@126.com

China,Nan Jing

2000/11/11

-------------------------  

   

{-----------------------------------------------------------------

Paste followd code into your old forms.pas file to fix the bug:

When maximizes several child windows in MDI,and closes the top one,then the window menus of next child don't disappear or become grey.

By Gene Fowler - acorioso@ccnet.com

-----------------------------------------------------------------}

procedure TCustomForm.MergeMenu(MergeState: Boolean);  

 var  

   AMergeMenu: TMainMenu;  

   Size: Longint;  

   FixMaximize: boolean;  

 begin  

   if not (fsModal in FFormState) and  

     (Application.MainForm <> nil) and  

     (Application.MainForm.Menu <> nil) and  

     (Application.MainForm <> Self) and  

     ((FormStyle = fsMDIChild) or (Application.MainForm.FormStyle <>

 fsMDIForm)) then  

   begin  

     AMergeMenu := nil;  

     if not (csDesigning in ComponentState) and (Menu <> nil) and  

       (Menu.AutoMerge or (FormStyle = fsMDIChild)) then AMergeMenu := Menu;  

     FixMaximize := MergeState and (FormStyle = fsMDIChild) and  

     (WindowState = wsMaximized);  

     // The important change from the healthy MergeMenu from D4  

     // is that the Restore/RE-maximize are split up to match the  

     // behavior described in the Win32 Help's wm_MDINext topic (at  

     // the bottom).  

     if FixMaximize then begin  

       { Force MDI to put back the system menu of a maximized child }  

       Size := ClientWidth + (Longint(ClientHeight) shl 16);  

       SendMessage(Handle, WM_SIZE, SIZE_RESTORED, Size);  

     end;  

     try  

     with Application.MainForm.Menu do  

     if MergeState then Merge(AMergeMenu) else Unmerge(AMergeMenu);  

     finally  

     if FixMaximize then  

       begin  

         Size := ClientWidth + (Longint(ClientHeight) shl 16);  

         SendMessage(Handle, WM_SIZE, SIZE_MAXIMIZED, Size);  

       end;  

     end;  

   end;  

 end;