Accessing protected properties

Ever wanted to access the Canvas property of a TPanel.

Or any other protected property of a class.

Ever wanted to access the Canvas property of a TPanel, or any other protected property of a class.



There is a way of doing it without having to create and install your own descendant of TPanel. Here is an example of accessing the Canvas property of a TPanel.



Near the TYPE declaration of your form do

Type

  THackPanel = class(TPanel)

  end;



in your code do



With THackPanel(MyPanel).Canvas do

begin

  // etc etc

end;

 

Share this article!

Follow us!

Find more helpful articles: