Search code examples
delphidrawinvisible

Draw an invisible control on a canvas in Delphi


I made a calendar component for Delphi. Now I want to add a visual effect to it while changing months (like Windows Vista standard calendar).

Now I want to create an invisible duplicate of the component and draw that one on the canvas to use it for the visual effect. I tried BitBlt function but it does not work because the control is invisible. Is there any way to draw an invisible control on a canvas?


Solution

  • Call the control's PaintTo method. That's for descendants of TWinControl.

    I don't see an analogous method for TGraphicControl descendants, but since those always require a TWinControl parent, you could just call PaintTo on the parent control to get an image of the TGraphicControl child.