如题

解决方案 »

  1.   

    哈哈,有意思
    放个panel,然后    Align = alClient
        BevelOuter = bvNone
        Caption = ''保证看不出来:)
      

  2.   

    呵呵,果然看不出来。
    但是如何显示MDI子窗体啊?
      

  3.   

    搞这稀奇古怪的东西干嘛, 难啦,
    截取这个消息WM_NCCALCSIZE,最好不要去试,  我要是你我就fsNormal了:)
      

  4.   

    以前的帖子有,只不过不是问的MDI,但原理一样,只用style中的WS_EX_CLIENTEDGE吧,不好意思,看看以前的帖子,我这里查不到,sorry
      

  5.   

    呵呵,firetoucher这次可栽了, WS_EX_CLIENTEDGE  跟MDI没关系
      

  6.   

    to firetoucher(风焱)
    不但没有去掉,反而变成两层边框了。哈哈
      

  7.   

    呵呵,DWGZ(),谁说WS_EX_CLIENTEDGE  跟MDI没关系?看看VCL的源码
    procedure ShowMDIClientEdge(ClientHandle: THandle; ShowEdge: Boolean);
    var
      Style: Longint;
    begin
      if ClientHandle <> 0 then
      begin
        Style := GetWindowLong(ClientHandle, GWL_EXSTYLE);
        if ShowEdge then
          if Style and WS_EX_CLIENTEDGE = 0 then
            Style := Style or WS_EX_CLIENTEDGE
          else
            Exit
        else if Style and WS_EX_CLIENTEDGE <> 0 then
          Style := Style and not WS_EX_CLIENTEDGE
        else
          Exit;
        SetWindowLong(ClientHandle, GWL_EXSTYLE, Style);
        SetWindowPos(ClientHandle, 0, 0,0,0,0, SWP_FRAMECHANGED or SWP_NOACTIVATE or
          SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER);
      end;
    end;
      

  8.   

    to:  myling(阿德) 
       兄弟,  俺在俺回答之前早就看过了(肯定在你之前:)),  并且还试过了,   这是咱的条件反射
      

  9.   

    to  myling(阿德) 
    哪个我也早就看了,但是没有用啊
      

  10.   

    我想把forms单元提出来,然后改掉那个函数。但是不行。
      

  11.   

    搞定了!利用子类化就能解决代码如下unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls, StdCtrls, jpeg, Buttons;type
      TForm1 = class(TForm)
      private
        FOldClientProc,
        FNewClientProc:TFarProc;
        procedure ClientWndProc(var Message: TMessage);
      public
        procedure CreateWnd;Override;
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    procedure ShowMDIClientEdge(ClientHandle: THandle; ShowEdge: Boolean);
    var
      Style: Longint;
    begin
      if ClientHandle <> 0 then
      begin
        Style := GetWindowLong(ClientHandle, GWL_EXSTYLE);
        if ShowEdge then
          if Style and WS_EX_CLIENTEDGE = 0 then
            Style := Style or WS_EX_CLIENTEDGE
          else
            Exit
        else if Style and WS_EX_CLIENTEDGE <> 0 then
          Style := Style and not WS_EX_CLIENTEDGE
        else
          Exit;
        SetWindowLong(ClientHandle, GWL_EXSTYLE, Style);
        SetWindowPos(ClientHandle, 0, 0,0,0,0, SWP_FRAMECHANGED or SWP_NOACTIVATE or
          SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER);
      end;
    end;procedure TForm1.ClientWndProc(var Message: TMessage);
    begin
      with Message do
        case Msg of
          $3F:
            begin
              if FormStyle = fsMDIForm then
               ShowMDIClientEdge(ClientHandle,false);
            end;
        else
          Result := CallWindowProc(FOldClientProc, ClientHandle, Msg, wParam, lParam);
        end;
    end;procedure TForm1.CreateWnd;
    begin
      inherited CreateWnd;
      FNewClientProc:=MakeObjectInstance(ClientWndProc);
      FOldClientProc:=pointer(GetWindowLong(ClientHandle,GWL_WNDPROC));
      SetWindowLong(ClientHandle,GWL_WNDPROC,Longint(FNewClientProc));
    end;end.
      

  12.   

    有什么不清楚的参照 D5开发指南 的 16.3 杂类MDI技术里面对这个技术讲的还是比较清楚的 
      

  13.   

    呵呵  myling(阿德) 也解决了
    虽然我也实现了,但是还会开贴的。
      

  14.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Menus;type
      TForm1 = class(TForm)
        MainMenu1: TMainMenu;
        a1: TMenuItem;
        miNewChild: TMenuItem;
        procedure FormCreate(Sender: TObject);
        procedure FormDestroy(Sender: TObject);
        procedure miNewChildClick(Sender: TObject);
      private
        FPrevWndProc, FNewWndProc: TFarProc;
        procedure ClientWndProc(var Message: TMessage);
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.ClientWndProc(var Message: TMessage);
    begin
      with Message do
      begin
        case Msg of
          WM_NCACTIVATE,
          WM_NCCALCSIZE:
            SetWindowLong(ClientHandle, GWL_EXSTYLE, GetWindowLong(ClientHandle, GWL_EXSTYLE) and not WS_EX_CLIENTEDGE);
        end;
        Result := CallWindowProc(FPrevWndProc, ClientHandle, Msg, WParam, LParam);
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      if ClientHandle <> 0 then
      begin
        FNewWndProc := MakeObjectInstance(ClientWndProc);
        FPrevWndProc := Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));
        SetWindowLong(ClientHandle, GWL_WNDPROC, Integer(FNewWndProc));
      end;
    end;procedure TForm1.FormDestroy(Sender: TObject);
    begin
      if ClientHandle <> 0 then
      begin
        SetWindowLong(ClientHandle, GWL_WNDPROC, Integer(FPrevWndProc));
        FreeObjectInstance(FNewWndProc);
      end;
    end;procedure TForm1.miNewChildClick(Sender: TObject);
    begin
      with TForm2.Create(Application) do Show;
    end;end.
    --------------------------------------------------------------------------------
    unit Unit2;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      TForm2 = class(TForm)
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
      private
        { Private declarations }
      public
        { Public declarations }
      end;{var
      Form2: TForm2;}implementation{$R *.dfm}procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      Action := caFree;
    end;end.