EDN Admin
Well-known member
This is the code im using now:
<pre class="prettyprint using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
namespace DownloadFlashFiles
{
public partial class Form1 : Form
{
Bitmap bmp;
Rectangle screenSize = Screen.PrimaryScreen.Bounds;
public Form1()
{
InitializeComponent();
pictureBox1.Size = new Size(screenSize.Width, screenSize.Height);
pictureBox1.Image = CaptureScreen();
bmp = new Bitmap(CaptureScreen());
bmp.Save(@"d:test.bmp");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private Image CaptureScreen()
{
Rectangle screenSize = Screen.PrimaryScreen.Bounds;
Bitmap target = new Bitmap(screenSize.Width, screenSize.Height);
using (Graphics g = Graphics.FromImage(target))
{
g.CopyFromScreen(0, 0, 0, 0, new Size(screenSize.Width, screenSize.Height));
}
return target;
}
}
}[/code]
When im looking on the bmp file on the hard disk i see the whole screen captured i can scroll up down using paint and see all the screen captured ok.
But when running the program in the pictureBox its missing the bounds around: right left top down. I see almost all the screen but its missing the bounds and i cant scroll up down left right like in paint when watching the bmp file.
The question is why it dosent show the whole captured screen in the pictureBox while it does in the bmp file ?
The Form size in the designer is: 910x583 and the pictureBox size is: 870x521
<
danieli
<br/>
View the full article
<pre class="prettyprint using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
namespace DownloadFlashFiles
{
public partial class Form1 : Form
{
Bitmap bmp;
Rectangle screenSize = Screen.PrimaryScreen.Bounds;
public Form1()
{
InitializeComponent();
pictureBox1.Size = new Size(screenSize.Width, screenSize.Height);
pictureBox1.Image = CaptureScreen();
bmp = new Bitmap(CaptureScreen());
bmp.Save(@"d:test.bmp");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private Image CaptureScreen()
{
Rectangle screenSize = Screen.PrimaryScreen.Bounds;
Bitmap target = new Bitmap(screenSize.Width, screenSize.Height);
using (Graphics g = Graphics.FromImage(target))
{
g.CopyFromScreen(0, 0, 0, 0, new Size(screenSize.Width, screenSize.Height));
}
return target;
}
}
}[/code]
When im looking on the bmp file on the hard disk i see the whole screen captured i can scroll up down using paint and see all the screen captured ok.
But when running the program in the pictureBox its missing the bounds around: right left top down. I see almost all the screen but its missing the bounds and i cant scroll up down left right like in paint when watching the bmp file.
The question is why it dosent show the whole captured screen in the pictureBox while it does in the bmp file ?
The Form size in the designer is: 910x583 and the pictureBox size is: 870x521
<
danieli
<br/>
View the full article