![]() |
Panel.Controls auf TShape prüfen
Hallo,
ich steh grad auf dem Schlauch: Ich lauf mit einer Schleife über alle Controls dir auf einem Panel liegen und will vergleichen on ein Control ein TShape ist. Irgendwie hab ich momentan einen Gedankenfehler.
Delphi-Quellcode:
Wie kann ich prüfen ob das Control ein TShape ist.for i := 0 to Pred(Panel_MSST.ControlCount) do begin Dummy_Shape := Panel_MSST.Controls[i] as TShape; //funkioniert nicht BTW.: Ich hab schon Panel.Components ausprobiert aber das funktioniert nicht (ComponentsCount = 0) |
Re: Panel.Controls auf TShape prüfen
Delphi-Quellcode:
if Panel_MSST.Controls[i] is TShape then
|
Re: Panel.Controls auf TShape prüfen
Danke! :thumb:
is gibts ja auch noch :-) |
Re: Panel.Controls auf TShape prüfen
Zitat:
Nach der "is"-Überprüfung kannst du anstatt eines Soft Casts einen Hard Cast machen: Also anstatt:
Delphi-Quellcode:
so:
if Panel_MSST.Controls[i] is TShape then
begin Dummy_Shape := Panel_MSST.Controls[i] as TShape; end
Delphi-Quellcode:
if Panel_MSST.Controls[i] is TShape then
begin Dummy_Shape := TShape(Panel_MSST.Controls[i]); end |
Re: Panel.Controls auf TShape prüfen
Danke!
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:16 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz