I need to make an inscription on TShape. I have a class in the fields of which there is a shape. In the class constructor, I create a shape. TShape is created on the panel whose property is visible = false;

 procedure TShape.Paint; var s : string; begin inherited; s := inttostr(tag); with Canvas do TextOut((Width - TextWidth(s)) div 2, (Height - TextHeight(s)) div 2, s); end; 

This code does not work if the panel is visible = false; Why? What is the way out of this situation? the number of class instances will be large, so I don’t want to create a label and so on.

  • Edited your question, please check and take note of the future (code design, extra thanks, tags) - Kromster
  • It is not clear how you determined that the code does not work. The shape is created on an invisible panel ..... and how do you want to see the result of the drawing? - dr. FIN
  • My showmessage is called at the end of the stream - Masha Malevich
  • @MashaMalevich so can you show exactly that piece of code that doesn't work? This cut should work fine if used correctly. Your question does not reflect how it is used and where. - dr. FIN

0