-2

How to take a screenshot of the the screen without hiding the form

I want to make the form visible while taking a screenshot...is there any way to do this...

I want to capture screenshot of behind form without hiding it

I hope this is not an easy task but I hope you can help me...

Please help me

ARUN V
  • 33
  • 1
  • 6
  • 1
    I think you need to elaborate and perhaps show some code, or show us what you've tried so far. Screenshots by definition include everything visible on the current visual layer of the screen which would include the form. I don't think it would be possible to do what you're asking. – JoeTomks Jun 06 '19 at 15:08
  • 1
    The part that is "behind the form" isn't actually there. Windows aren't physically sat on top of each other. If you want something "behind" a form then you have to move the form so that the behind is rendered. Also, with no effort from yourself this is literally asking "write my code". This is out of scope for Stack Overflow. If you have any relevant code then please post it. – Reinstate Monica Cellio Jun 06 '19 at 15:11

2 Answers2

0

I don't know about behind but you have have them side by side, like split screen.

If you open both the form and the code in visual studio, then click and drag one of the tabs onto the screen and you will see a little menu with different screen areas, just drag the tab to the screen area and the screen will split. enter image description here

Dean2690
  • 230
  • 1
  • 6
  • 14
0

To capture a screenshot read this: Capture the Screen into a Bitmap

Before taking a screenshot just do this.Hide() in the Form class.

After taking the screenshot you can show the Form again using this.Show()

Sample code:

this.Hide();
//Create a new bitmap.
var bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
                           Screen.PrimaryScreen.Bounds.Height,
                           PixelFormat.Format32bppArgb);

// Create a graphics object from the bitmap.
var gfxScreenshot = Graphics.FromImage(bmpScreenshot);

// Take the screenshot from the upper left corner to the right bottom corner.
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
                        Screen.PrimaryScreen.Bounds.Y,
                        0,
                        0,
                        Screen.PrimaryScreen.Bounds.Size,
                        CopyPixelOperation.SourceCopy);

// Save the screenshot to the specified path that the user has chosen.
bmpScreenshot.Save("Screenshot.png", ImageFormat.Png);

this.Show();
Owns_Rekt
  • 164
  • 11
  • Hey I don't want to hide the form even for a milliseconds...I want always visible form while taking screenshot. Your code looks like first hiding the form and the showing it again...this is not what I wanted – ARUN V Jun 06 '19 at 15:28
  • 1
    First of all you shouldn't recognize the hide and show. The problem is that windows doesn't draw pixels behind a window :). It's not possible to get those pixels. My solution is the nearest possible thing. – Owns_Rekt Jun 06 '19 at 15:32
  • If It's near to be your expected result please mark It as the correct answer. – Owns_Rekt Jun 06 '19 at 15:47