private void Demo_Load(object sender, EventArgs e) { int pos_x = 0; InitializeWindowPosition(ref pos_x); this.Left = pos_x; this.WindowState = FormWindowState.Maximized; uint deviceID = 1; DISPLAY_DEVICE d = new DISPLAY_DEVICE(); DEVMODE dm = new DEVMODE(); d.cb = Marshal.SizeOf(d); NativeMethods.EnumDisplayDevices(null, deviceID, ref d, 0); if (0 != NativeMethods.EnumDisplaySettings( d.DeviceName, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm)) { label3.Text = "Resolution : " + dm.dmPelsWidth.ToString() + "x" + dm.dmPelsHeight.ToString(); } else { deviceID = 0; NativeMethods.EnumDisplayDevices(null, deviceID, ref d, 0); if (0 != NativeMethods.EnumDisplaySettings( d.DeviceName, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm)) { label3.Text = "Resolution : " + dm.dmPelsWidth.ToString() + "x" + dm.dmPelsHeight.ToString(); } } realTimeStylusPluginsControl1.Init(); realTimeStylusPluginsControl1.ReturnXYZCallback += realTimeStylusPluginsControl1_ReturnXYZCallback; realTimeStylusPluginsControl1.ReturnDataCallback += realTimeStylusPluginsControl1_ReturnDataCallback; progressBar1.Maximum = 2048; }
internal static extern int EnumDisplaySettings( string lpszDeviceName, int iModeNum, ref DEVMODE lpDevMode);
internal static extern DISP_CHANGE ChangeDisplaySettingsEx( string lpszDeviceName, ref DEVMODE lpDevMode, IntPtr hwnd, DisplaySettingsFlags dwflags, IntPtr lParam);