从VCL可以看到, 方法1:DestroyHandle之后Create了新的,2:没有.所以第一种方式会出现闪烁
procedure TCustomForm.SetFormStyle(Value: TFormStyle);
var
  OldStyle: TFormStyle;
begin
  if FFormStyle <> Value then
  begin
    if (Value = fsMDIChild) and (Position = poDesigned) then
      Position := poDefault;
    if not (csDesigning in ComponentState) then DestroyHandle;
    OldStyle := FFormStyle;
    FFormStyle := Value;
    if ((Value = fsMDIForm) or (OldStyle = fsMDIForm)) and not Ctl3d then
      Color := NormalColor;
    if not (csDesigning in ComponentState) then UpdateControlState;
    if Value = fsMDIChild then Visible := True;
  end;
end;
....
procedure TCustomForm.CreateWnd;
var
  ClientCreateStruct: TClientCreateStruct;
begin
  inherited CreateWnd;
  if NewStyleControls then
    if BorderStyle <> bsDialog then
      SendMessage(Handle, WM_SETICON, 1, GetIconHandle) else
      SendMessage(Handle, WM_SETICON, 1, 0);
  if not (csDesigning in ComponentState) then
    case FormStyle of
      fsMDIForm:
        begin
          with ClientCreateStruct do
          begin
            idFirstChild := $FF00;
            hWindowMenu := 0;
            if FWindowMenu <> nil then hWindowMenu := FWindowMenu.Handle;
          end;
          FClientHandle := Windows.CreateWindowEx(WS_EX_CLIENTEDGE, 'MDICLIENT',
            nil, WS_CHILD or WS_VISIBLE or WS_GROUP or WS_TABSTOP or
            WS_CLIPCHILDREN or WS_HSCROLL or WS_VSCROLL or WS_CLIPSIBLINGS or
            MDIS_ALLCHILDSTYLES, 0, 0, ClientWidth, ClientHeight, Handle, 0,
            HInstance, @ClientCreateStruct);
          FClientInstance := Classes.MakeObjectInstance(ClientWndProc);
          FDefClientProc := Pointer(GetWindowLong(FClientHandle, GWL_WNDPROC));
          SetWindowLong(FClientHandle, GWL_WNDPROC, Longint(FClientInstance));
        end;
      fsStayOnTop:
        SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
          SWP_NOSIZE or SWP_NOACTIVATE);
    end;
end;

解决方案 »

  1.   

    Ctrl+鼠标左在TForm上点下!然后在该Form单元下查找!
      

  2.   

    哪位兄弟能把这个单元的程序功能和作用说清楚,或者说有没有这方面的资料?谢谢.最好其它单元也有,比如说 windows,classes等。
      

  3.   

    Forms.pas
    Delphi\Source\里什么都有,VCL是Open source的,你可以自己改的,不过最好别改VCL
      

  4.   

    里面的东四你们能全都看得懂吗?能不能解释一下,或寄份资料给我。
    非常感谢!  [email protected]
      

  5.   

    我觉得vcl 比mfc 一点也不容易!
      

  6.   

    里面的东四你们能全都看得懂吗?能不能解释一下,或寄份资料给我。
    非常感谢!  [email protected]
      

  7.   

    看不懂只能说明你不太熟习Object Pascal,VCL比MFC确实更容易理解!所有的类,函数,方法,变量的定义,来龙去脉都可以看到(Ctrl+鼠标左键在上面点下),还有什么不好理解的?