首页  编辑  

去掉MDI主窗体客户区凹陷的效果

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

在DELHPI6中加入了一个主窗体,并将该窗体的formstyle设置成fsMDIform,在该窗体上加入菜单,运行时发现菜单以下部分窗体有明显凹进去的现象,如何消除?

windoze@yeah.net:

重载窗体WndProc:

  private

    { Private declarations }

   FClientInstance : TFarProc ;

   FPrevClientProc : TFarProc ;

    procedure ClientWndProc ( var Message : TMessage );

procedure TForm1 . ClientWndProc ( var Message : TMessage );

begin

  with Message do

    case Msg of

      $3F :

        begin

         SetWindowLong ( ClientHandle , GWL_EXSTYLE , 0 );

         SetWindowPos ( ClientHandle , 0 , 0 , 0 , 0 , 0 , SWP_FRAMECHANGED

            or SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER );

        end ;

    else

     Result := CallWindowProc ( FPrevClientProc ,

       ClientHandle , Msg , wParam , lParam );

    end ;

end ;

procedure TForm1 . FormCreate ( Sender : TObject );

begin

 FClientInstance := MakeObjectInstance ( ClientWndProc );

 FPrevClientProc := Pointer ( GetWindowLong ( ClientHandle , GWL_WNDPROC ));

 SetWindowLong ( ClientHandle , GWL_WNDPROC , LongInt ( FClientInstance ));

end ;