public void Capture() { GC.Collect(); Bitmap bmp = new Bitmap(sz.Width, sz.Height); Graphics g = Graphics.FromImage(bmp); g.CopyFromScreen(xy, Point.Empty, sz); frmPreview = new preview(xy, sz, bmp); frmPreview.Show(); frmPreview.WindowState = FormWindowState.Normal; }
void init() { //frmPreview frmPreview = null; frmsetting = null; //설정 불러오기 if (File.Exists(Path.Combine(Application.StartupPath, "setting.cfc"))) { StreamReader sr = new StreamReader(Path.Combine(Application.StartupPath, "setting.cfc"), Encoding.UTF8, true); string rr; string[] rr2; char[] param = new char[] { '*' }; while (sr.Peek() >= 0) { rr = sr.ReadLine(); rr2 = rr.Split(param); switch (rr2[0]) { case "ClickTrayIcon": frmSetting.tray = Convert.ToInt16(rr2[1]); break; case "DefaultDirectory": frmSetting.defaultdirectory = rr2[1]; break; case "Opacity": frmSetting.opacity = Convert.ToInt16(rr2[1]); break; case "LocationMode": frmSetting.locationmode = Convert.ToInt16(rr2[1]); break; case "LastLocation": string[] rr3 = rr2[1].Split(new string[] { "," }, StringSplitOptions.None); frmSetting.lastlocation.X = Convert.ToInt16(rr3[0]); frmSetting.lastlocation.Y = Convert.ToInt16(rr3[1]); break; case "isAutoClose": if (rr2[1] == "True") { frmSetting.isAutoClose = true; } else { frmSetting.isAutoClose = false; } break; case "AutoCloseTime": frmSetting.autoclosetime = Convert.ToInt16(rr2[1]); if (frmSetting.autoclosetime == 0) { frmSetting.autoclosetime = 1; } break; case "isSaveCB": if (rr2[1] == "True") { frmSetting.isSaveCB = true; } else { frmSetting.isSaveCB = false; } break; case "isSaveAuto": if (rr2[1] == "True") { frmSetting.isSaveAuto = true; } else { frmSetting.isSaveAuto = false; } break; case "isSaveOpen": if (rr2[1] == "True") { frmSetting.isSaveOpen = true; } else { frmSetting.isSaveOpen = false; } break; case "isRunStartup": if (rr2[1] == "True") { frmSetting.isRunStartup = true; } else { frmSetting.isRunStartup = false; } break; case "isCaptureWholeScreen": if (rr2[1] == "True") { frmSetting.isCaptureWholeScreen = true; } else { frmSetting.isCaptureWholeScreen = false; } break; } } sr.Close(); sr.Dispose(); } else { frmSetting.tray = 0; frmSetting.defaultdirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); frmSetting.opacity = 70; frmSetting.lastlocation.X = 0; frmSetting.lastlocation.Y = 0; frmSetting.locationmode = 0; frmSetting.autoclosetime = 3; frmSetting.isAutoClose = false; frmSetting.isSaveCB = true; frmSetting.isSaveAuto = false; frmSetting.isSaveOpen = false; frmSetting.isRunStartup = false; frmSetting.isCaptureWholeScreen = false; } }