VB.NET ทำการ Capture Screen ในส่วนของ Windows Form ที่กำลังเปิดอยู่ปัจจุบัน เฉพาะ Form
Tag : - - - -
Date :
2009-12-16 12:38:27
By :
ksp
View :
2641
Reply :
3
No. 1
Guest
Code (C#)
private void Savepic_Click(object sender, EventArgs e)
{
Rectangle form = this.Bounds;
Bitmap bitmap = new Bitmap(form.Width, form.Height);
Graphics graphic = Graphics.FromImage(bitmap);
graphic.CopyFromScreen(form.Location, Point.Empty, form.Size);
SaveFileDialog save = new SaveFileDialog();
save.Filter = "bmpfiles|*.bmp";
if (save.ShowDialog() == DialogResult.OK)
{
bitmap.Save(save.FileName);
}
}
Date :
2011-08-25 20:43:05
By :
thaicreate
No. 2
Guest
Code (VB.NET)
Private Sub Savepic_Click(sender As Object, e As EventArgs)
Dim form As Rectangle = Me.Bounds
Dim bitmap As New Bitmap(form.Width, form.Height)
Dim graphic As Graphics = Graphics.FromImage(bitmap)
graphic.CopyFromScreen(form.Location, Point.Empty, form.Size)
Dim save As New SaveFileDialog()
save.Filter = "bmpfiles|*.bmp"
If save.ShowDialog() = DialogResult.OK Then
bitmap.Save(save.FileName)
End If
End Sub