Platform: UBUNTU
IDE: MonoDevelop 2.8.6.3
Language: C#.NET
I have created a function which makes a screenshot and returns that screenshot as a Bitmap. Like this:
/* Variable to store bitmap data in */
Bitmap bmp;
/* Create screenshot. Return result to variable 'bmp' */
getScreenShot(bmp);
My question is:
How do I create a form/window (or whatever makes sense) which displays the screenshot (i.e. the bmp data) ? I want to do it programmatically.
I tried to do it like this:
public static void Main (string[] args)
{
Bitmap bmp = null;
Form form = new Form
{
Name = "Screenshot Displayer",
Size = new System.Drawing.Size(800, 800),
Location = new System.Drawing.Point(140, 170),
Visible=true
};
/* Get screenshot */
Gdk.Global.InitCheck(ref args);
screenCapture.getScreenShot(bmp);
form.BackgroundImage = bmp;
form.Show();
}
I tried this as well and it doesn't work.
PictureBox P = new PictureBox();
Bitmap bmp = null;
Form form = new Form
{
Name = "Screenshot Displayer",
Size = new System.Drawing.Size(800, 800),
Location = new System.Drawing.Point(140, 170),
Visible=true
};
bmp = new Bitmap("screenshot0.bmp");
P.Image = bmp;
form.Controls.Add (P);
form.Show();