public FormScreenSaverCancel(FormScreenSaver formScreenSaver) { InitializeComponent(); this.formScreenSaver = formScreenSaver; formScreenSaver.SetFormScreenSaverCancel(this); // 없어도 되나? 가보면 주석처리 돼있음 this.TopMost = true; }
public void SetFormScreenSaver(FormScreenSaver screenSaver) { try { this._screenSaver1 = screenSaver; } catch (Exception ex) { _log.write(ex.Message); frmMain._log.write(ex.StackTrace); } }
void DualMonitor(Screen[] screen, int primaryNum) { try { Point point; int screen1 = 0; int screen2 = 1; if (screen[primaryNum] == screen[screen1]) { _screenSaver1 = new FormScreenSaver(this); point = new Point(screen[screen1].Bounds.Location.X, screen[screen1].Bounds.Location.Y); _screenSaver1.Location = point; //GIF파일의 크기를 메인모니터 크기로 조정 //screenSaver.pb_screenSaver.Size = new Size(screen[screen1].WorkingArea.Width, screen[screen1].WorkingArea.Height); _screenSaver1.Size = new Size(screen[screen1].Bounds.Width, screen[screen1].Bounds.Height); #if debug _screenSaver1.Size = new Size(100, 100); #endif _screenSaver1.Show(this); //KeyboardHooking.TaskBarHide(); } else { //전체 해상도를 가져온다. int nVirtualWidth = GetSystemMetrics((int)SystemMetric.SM_CXVIRTUALSCREEN); int nVirtualHeight = GetSystemMetrics((int)SystemMetric.SM_CYVIRTUALSCREEN); //Primary monitor 해상도만 가져온다. int nPrimaryWidth = GetSystemMetrics((int)SystemMetric.SM_CXSCREEN); int nPrimaryHeight = GetSystemMetrics((int)SystemMetric.SM_CYSCREEN); //서브모니터의 해상도는 int nSubWidth = nVirtualWidth - nPrimaryWidth; int nSubHeight = nVirtualHeight - nPrimaryHeight; //Primary 를 기준으로 좌표 값이 오는듯합. 실제 해상도랑 틀려서 보정해줌. ??? 뭔지 모르겠다. int Scale = nSubWidth / nPrimaryWidth; Graphics g = Graphics.FromHwnd(IntPtr.Zero); IntPtr desktop = g.GetHdc(); int PhysicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.DESKTOPVERTRES); //int a = GetSystemMetrics(SM_CXVIRTUALSCREEN); _screenSaver2 = new FormScreenSaver(this); point = new Point(screen[screen2].Bounds.Location.X, screen[screen2].Bounds.Location.Y); _screenSaver2.Location = point; //GIF파일의 크기를 서브모니터 크기로 조정 _screenSaver2.Size = new Size(screen[screen2].Bounds.Width, screen[screen2].Bounds.Height); #if debug _screenSaver2.Size = new Size(100, 100); #endif _screenSaver2.Show(this); } } catch (Exception ex) { frmMain._log.write(ex.Message); frmMain._log.write(ex.StackTrace); } }