IsChild API與Delphi裡的Parent不是一回事(Windows視窗自己不能是自己的子視窗,但Delphi不一定)

來源:互聯網
上載者:User

標籤:

建立一個Form,上面放一個Button1,一個Panel1,然後在Panel1上再放一個Button2,測試結果:

procedure TForm1.Button1Click(Sender: TObject);begin    if IsChild(handle, handle) then ShowMessage(‘yes‘) else ShowMessage(‘no‘); // 顯示No, 因為Form自己不是自己的Child    if IsChild(handle, button1.handle) then ShowMessage(‘yes‘) // 顯示Yes    else ShowMessage(‘no‘);    if IsChild(handle, panel1.handle) then ShowMessage(‘yes‘) // 顯示Yes    else ShowMessage(‘no‘);    if IsChild(handle, button2.handle) then ShowMessage(‘yes‘) // 顯示Yes,要研究一下,為什麼    else ShowMessage(‘no‘);end;procedure TForm1.Button2Click(Sender: TObject);begin    ShowMessage(button2.Parent.Name); // 顯示Panel1end;

 TWinControl.CreateWindowHandle使用了TCreateParams.WndParent作為父視窗的控制代碼,那麼button2的父視窗是什麼時候設定的呢?

IsChild API與Delphi裡的Parent不是一回事(Windows視窗自己不能是自己的子視窗,但Delphi不一定)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.