Jump to content
aehimself

Screenshot each sheet in a PageControl

Recommended Posts

Hello,

 

I have a pagecontrol with multiple tabs. I would like to make a screenshot (paint the whole control in a TBitmap) for further processing. The currently visible one paints just fine but I have no success of the ones which are not. Either I get an image of the active one, the bitmap is completely white or black. I already tried

- PageControl.Pages[a].PaintTo

- BitBlt

- PrintWindow WinApi

 

I know I can quickly activate each tab and grab a shot of them but I'd like to avoid this "flicker" if I could. I'll keep researching but in the mean time if anyone has an idea of what I can try I would be really thankful :)

 

Cheers!

Share this post


Link to post

A TPageControl is just a tab control with each page represented by a TTabSheet.

 

If you look at the source of TPageControl.ChangeActivePage you can see that it sets Visible=True for the active page and Visible=False for the page being deactivated (if any).

 

Since you can't paint a control that has Visible=False my guess is that what you are trying to do isn't possible without some really nasty hacks.

 

What I think might be possible is to block repaints of the page control (LockWindowUpdate etc.), make each tab visible directly (via TTabSheet.Visible), paint them to a bitmap, restore everything, and resume repaint - or some variation of this.

Share this post


Link to post

Call

HandleNeeded 

on each tab instead of activating it.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×