前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
![]()
public Form1()
{
InitializeComponent();
FormClosing += new FormClosingEventHandler(Form_Closing);
}
|
private void Form_Closing(object sender, FormClosingEventArgs e)
{
int width, height;
width = Screen.PrimaryScreen.Bounds.Width;
height = Screen.PrimaryScreen.Bounds.Height;
Bitmap bmp = new Bitmap(width, height);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(new Point(0, 0), new Point(0, 0), bmp.Size);
g.Dispose();
bmp.Save("c:\\tmp\\w.png");
bmp.Dispose();
}
|
bmp.Save("c:\\tmp\\w.bmp", ImageFormat.Bmp);
|
![]()
private void Form_Closing(object sender, FormClosingEventArgs e)
{
Bitmap bmp = new Bitmap(this.Width, this.Height);
this.DrawToBitmap(bmp, new Rectangle(0, 0, this.Width, this.Height));
bmp.Save("C:\\tmp\\w.png");
bmp.Dispose();
}
|
![]()
MessageBox.Show("Width:" + width + " Height:" + height);
|
width = Screen.PrimaryScreen.Bounds.Width;
height = Screen.PrimaryScreen.Bounds.Height;
width = (int)(width*1.5);
height = (int)(height*1.5);
MessageBox.Show("Width:" + width + " Height:" + height);
Bitmap bmp = new Bitmap(width, height);
|
![]()