I built simple application to take full screenshot each 100ms of computer's screen and set the screenshots on the PictureBox :
- private void StartWork()
- {
- try
- {
- // width :1916 and height :1074 is the best measure to take full screenshot of whole laptotp's screen
- using (Image bitmap = new Bitmap(1916, 1074))
- {
- using (Graphics g = Graphics.FromImage(bitmap))
- {
- g.CopyFromScreen(Point.Empty, Point.Empty, new Size(1916, 1074));
- }
- pictureBox1.BackgroundImage = (Image)bitmap.Clone();
- pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
- //Sending Function to Send every token screenshot to all connected TcpClients
- // Sending(bitmap);
- pictureBox1.Invalidate();
- pictureBox1.Refresh();
- }
- }
- catch (Exception ee)
- {
- // MessageBox.Show(ee.Message);
- }
- }
calling StartWork() in every 100ms in Tick event :
- private void timer1_Tick(object sender, EventArgs e)
- {
- StartWork();
- }
Data = {System.Collections.ListDictionaryInternal}
HResult = -2147024809
Message = "Parameter is not valid."
Source = "System.Drawing"
StackTrace = " at System.Drawing.Graphics.GetHdc()\r\n at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)\r\n at System.Drawing.Graphics.CopyF...
TargetSite = {IntPtr GetHdc()}
I was searched in simillar problems in CSharp Corner and Stackoverflow and try to change a lot of things but really i becommed tired.
please developers how solve this problem .
Thanks in Advance .

Abdulmajeed AlshariPosted Oct 15, 2020, 6:20 PM
Abdulmajeed AlshariPosted Oct 15, 2020, 5:51 AM
Sachin SinghPosted Oct 15, 2020, 3:33 AM
Junaid MuslaPosted Oct 15, 2020, 3:30 AM