Member Avatar for Thew

Hello,
I want to ask you if there is some way how to print visual components like TButton with TPrinter? I've seen only examples how to print images etc. (which contain TGraphic).
Thanks

You should draw it to a bitmap and print that. I've done that previously. Do you have other requirements?

I think PollH is right.

Suppose you have created a TPrinter object named P and B, contained in Form1, is the button you'd like to print , you may call the CopyRect method in this way:

P.Canvas.CopyRect(Rect(0, 0, B.Width, B.Height), Form1.Canvas, B.BoundsRect);

You have to make the P object ready to print before calling this method. You can adjust the first parameter if you would like to print the button at a specific position instead of the upleft corner.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.