I have decided to explore an alternate method for obtaining a screen capture that includes all tool tips. Note that some tool tips seem to appear (for instance, some Visual Studio tooltips are captured, while others - notably those in the property window - aren't). The important ones that fail to capture are any along the task bar, quick launch bar, system tray - in short, anything adjacent to the start menu's "start" button.
So I decided to test hitting the "Print Screen" button on my keyboard and pasting the contents of the clipboard into a word document. Sure enough, the screen capture resulting from this operation did include all tool tips.
The strategy then would be to:
1. Run a timer control.
2. Each tick, try to force Window's to perform it's "Print Screen" operation, copying the screen to the clipboard.
3. Use the Clipboard.GetImage() method to retrieve the newly captured screen image.
One problem, however. I can't seem to force Windows to capture the screen via code. It only works when I physically press the "Print Screen" key.
I've deleted my test code, but it looked something like:
Code:
private void Timer_Tick(object sender, EventArgs e)
{
// Since Graphics.CopyFromScreen() doesn't copy all tooltips,
// try to force Windows to copy the screen (including tooltips)
// to the clipboard. Do this by simulating a "Print Screen"
// button key up command.
this.OnKeyUp(new KeyEventArgs(Keys.PrintScreen));
}
protected override void OnKeyUp(KeyEventArgs e)
{
// Allow the base object to handle the key press in order
// to force Windows to capture the screen to the clipboard.
base.OnKeyUp(e);
if (Clipboard.ContainsImage())
{
// Retrieve the newly captured desktop image.
Image desktopImage = Clipboard.GetImage();
// Using the image, update my magnification display.
this.UpdateMagnifier(desktopImage);
}
}
Any ideas on how to simulate a "Print Screen" buttn keypress in order to force Windows to copy the screen to the clipboard. Thanks.
- Roger