private void Form2_Load(object sender, EventArgs e)
{
con1.Open();
Form1 home = new Form1();
home.MdiParent = this.MdiParent ;
System.Timers.Timer timer1 = new System.Timers.Timer();
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyComputer) + @"\\server1\KamalSingh\ScreenCaptures");
t.Interval = 500;
t.Tick += new EventHandler(StartThread);
t.Start();
}
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
//Thread tt;
private static Bitmap bmpscreenshot;
private static Graphics gfxscreenshot;
void TakeScreenShot()
{
bmpscreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height,PixelFormat.Format32bppArgb);
gfxscreenshot = Graphics.FromImage(bmpscreenshot);
gfxscreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,Screen.PrimaryScreen.Bounds.Y,0,0,Screen.PrimaryScreen.Bounds.Size,CopyPixelOperation.SourceCopy);
bmpscreenshot.Save(Environment.GetFolderPath(Environment.SpecialFolder.MyComputer) [email protected]"\\server1\KamalSingh\ScreenCaptures\.bmp", ImageFormat.Png);
// tt.Abort();
}
protected void StartThread(object sender, EventArgs e)
{
Thread th = new Thread(new ThreadStart(TakeScreenShot));
th.SetApartmentState(ApartmentState.STA);
th.Start();
Thread.Sleep(100);
th.Join();
}
내 프로그램을 실행할 때 발생하는이 오류를 수정하고 싶습니다. 시간이 지나면 오류가 발생합니다.이 오류를 제거하는 방법 GDI +에서 일반 오류가 발생했습니다.
코드 덤프보다는 어떤 일이 일어나는지에 대한 설명을 제공 할 수 있습니까? –
나는 스크린 샷 사진을 폴더에 저장하려고합니다. 또한 스크린 샷 사진은 윈도우 응용 프로그램의 그림 상자에 표시됩니다. 또한 스크린 샷 사진의 크기를 줄이려고합니다. –