0
다음과 같은 내선 Winform 응용 프로그램에 대한 Exception Extension이 있습니다. 내 문제는 ss.save("C:\\HelpMe.jpg", ImageFormat.Jpeg);
에 generic GDI+
오류가 발생했습니다.ScreenShot에서 GDI + 일반 오류가 발생했습니다.
언제든지 작동하고 오류가 발생할 때마다 나타나는 것은 아닙니다. 때로는 두 번 연속으로 작동합니다.
"잠금"문제 일 수 있습니까? 그 밖의 무엇을보고해야하며 잘못하고 있습니까?
그래서 같은이 전화 ->
catch (Exception ex)
{
ex.LogError(HUD.ShellForm);
}
public static void LogError(this Exception exception, DevExpress.XtraEditors.XtraForm whichForm)
{
GetDesktopImage(whichForm);
SendExceptionMail(exception);
ExceptionMessageBox box = new ExceptionMessageBox(exception);
box.Show(whichForm);
}
private static void SendExceptionMail(Exception exception)
{
SmtpClient smtpClient = new SmtpClient("MailServer");
MailMessage message = new MailMessage
{
From = new MailAddress("[email protected]"),
Subject = "MATRIX Application Error",
Body = exception.Message
};
Attachment attachment = new Attachment(@"C:\\HelpMe.jpg");
message.Attachments.Add(attachment);
message.To.Add("[email protected]");
message.To.Add("[email protected]");
smtpClient.Send(message);
}
///<summary>
/// Grabs a screen shot of the App and saves it to the C drive in jpg
///</summary>
private static void GetDesktopImage(DevExpress.XtraEditors.XtraForm whichForm)
{
Rectangle bounds = whichForm.Bounds;
using (Bitmap ss = new Bitmap(bounds.Width, bounds.Height))
using (Graphics g = Graphics.FromImage(ss))
{
g.CopyFromScreen(whichForm.Location, Point.Empty, bounds.Size);
ss.Save("C:\\HelpMe.jpg", ImageFormat.Jpeg);
}
}
에 대한 쓰기 권한이 없습니다. Win 7이며 모든 사용자는 로컬 관리자입니다 (메신저를 쏘지 마십시오). 또한, 그것이 문제라면 처음부터 파일을 만들 수있을 것이라고 생각하지 않습니다 .... –