เขียน จับภาพบนหน้าจอด้วย asp.net ตอนเทสที่เครื่องปกติแต่พอลง server มีอาการ error ครับ อาจารย์
2 posters
หน้า 1 จาก 1
เขียน จับภาพบนหน้าจอด้วย asp.net ตอนเทสที่เครื่องปกติแต่พอลง server มีอาการ error ครับ อาจารย์
//ผมใช้โค้ดนี้ รันที่เครื่องได้ปกติ
// พอรันที่ server มันแจ้ง A generic error occurred in GDI+.
Rectangle rc = new Rectangle(0, 0, 1024, 768);
Bitmap memoryImage = new Bitmap(rc.Width, rc.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
string filePath = String.Format("{0}\\Sample.gif", Server.MapPath(""));
using (Graphics memoryGraphics = Graphics.FromImage(memoryImage))
{
try
{
memoryGraphics.CopyFromScreen(rc.X, rc.Y, 0, 0, rc.Size, CopyPixelOperation.SourceCopy);
memoryGraphics.Dispose();
}
catch (Exception ex)
{
Response.Write("Error::" + ex.Message);
Response.Write("Error::" + ex.ToString());
// getting error -> Error::The handle is invalid
}
}
memoryImage.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);[img] [/img]
// พอรันที่ server มันแจ้ง A generic error occurred in GDI+.
Rectangle rc = new Rectangle(0, 0, 1024, 768);
Bitmap memoryImage = new Bitmap(rc.Width, rc.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
string filePath = String.Format("{0}\\Sample.gif", Server.MapPath(""));
using (Graphics memoryGraphics = Graphics.FromImage(memoryImage))
{
try
{
memoryGraphics.CopyFromScreen(rc.X, rc.Y, 0, 0, rc.Size, CopyPixelOperation.SourceCopy);
memoryGraphics.Dispose();
}
catch (Exception ex)
{
Response.Write("Error::" + ex.Message);
Response.Write("Error::" + ex.ToString());
// getting error -> Error::The handle is invalid
}
}
memoryImage.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);[img] [/img]
izax- จำนวนข้อความ : 1
Join date : 26/01/2011
Similar topics
» ลากวัตถุด้วยเมาส์ทำอย่างไรครับ
» อยากสอบถามเนื้อหาในหน้าที่ 56 ครับ ที่อธิบาย ER รูปที่ 1.8 ในหน้าที่ 55 ครับ
» รับค่า output จาก contact (NO,NC) ด้วย rs232
» เขียน Asp.net แบบธรรมดา กับ แบบ MVC แบบไหนดีกว่ากันครับ
» เขียน Code ของ Web App ยังไงให้แสดงรูปใน Crystal Report จาก File Path ในฐานข้อมูล
» อยากสอบถามเนื้อหาในหน้าที่ 56 ครับ ที่อธิบาย ER รูปที่ 1.8 ในหน้าที่ 55 ครับ
» รับค่า output จาก contact (NO,NC) ด้วย rs232
» เขียน Asp.net แบบธรรมดา กับ แบบ MVC แบบไหนดีกว่ากันครับ
» เขียน Code ของ Web App ยังไงให้แสดงรูปใน Crystal Report จาก File Path ในฐานข้อมูล
หน้า 1 จาก 1
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ
|
|