Delphi - 창 작성 프로세스

1922 단어 Delphi
대부자로부터 왔다.
1、TCustomForm.Create

     TCustomForm.Create     TCustomForm.CreateNew;



2、TCustomForm.CreateNew;

      FCanvas := TControlCanvas.Create;

      TControlCanvas.Create;

      TControlCanvas.CreateHandle;



3、TControlCanvas.CreateHandle;

      FControl.GetDeviceContext(FWindowHandle);

     TWinControl.GetDeviceContext(FWindowHandle);



4、TWinControl.GetDeviceContext(FWindowHandle);

      TWinControl.GetDC(Handle);



      :

     TWinControl   Handle          TWinControl.GetHandle;

     Property Handle;    。



5、      Handle     ,      :(TWinControl)

    Handle->GetHandle->HandleNeeded



6、TWinControl.HandleNeeded    FHandle   :

  if FHandle = 0 then

  begin

    if Parent <> nil then Parent.HandleNeeded;

    CreateHandle; //    CreateHandle;

  end;



7、TWinControl.CreateHandle

      CreateWnd;

   if FHandle = 0 then //    FHandle     

   begin

     CreateWnd;

     ...

   end;



8、TWinControl.CreateWnd

      CreateParams(Params);

   //               

   CreateParams(Params);

   with Params do

   begin

     ...

     //     API   ,     ,CreateWindowEx ...

     if Windows.RegisterClass(WindowClass) = 0 then RaiseLastWin32Error;

     ...

     CreateWindowHandle(Params);

     ...

   end;



9、CreateWindowHandle(Params);

   FHandle :=  CreateWindowEx(ExStyle, WinClassName, Caption, Style,

      X, Y, Width, Height, WndParent, 0, WindowClass.hInstance, Param);

            ,    FHandle     。



10、     

   CreateNew      DoCreate

   try

     CreateNew(AOwner);

     ...

       if OldCreateOrder then DoCreate;

   finally

     ...

   end;



11、DoCreate

          OnCreate   :

    if Assigned(FOnCreate) then

    try

      FOnCreate(Self); //    OnCreate;

    except

      Application.HandleException(Self);

    end;

    if fsVisible in FFormState then Visible := True;


우리 Oncreate 사건은 마지막에 촉발되었다.

좋은 웹페이지 즐겨찾기