private void OnLoaded(object sender, RoutedEventArgs e)
        {
            //Get references to window, screen, toastNotification and mainViewModel
            window = Window.GetWindow(this);
            screen = window.GetScreen();
            toastNotification = VisualAndLogicalTreeHelper.FindLogicalChildren<ToastNotification>(this).First();
            var mainViewModel = DataContext as MainViewModel;

            //Handle ToastNotification event
            mainViewModel.ToastNotification += (o, args) =>
            {
                SetSizeAndPosition();

                Title = args.Title;
                Content = args.Content;
                NotificationType = args.NotificationType;

                Action closePopup = () =>
                {
                    if (IsOpen)
                    {
                        IsOpen = false;
                        if (args.Callback != null)
                        {
                            args.Callback();
                        }
                    }
                };

                AnimateTarget(args.Content, toastNotification, closePopup);
                IsOpen = true;
            };
        }
Beispiel #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Determines whether or not the specified screen is a virtual device. Virtual displays
		/// can usually be ignored.
		/// </summary>
		/// <param name="scrn">Screen to test.</param>
		/// <returns>True if screen is virtual. Otherwise, guess</returns>
		/// ------------------------------------------------------------------------------------
		public static bool ScreenIsVirtual(Screen scrn)
		{
			// We're really looking for a string containing DISPLAYV, but something is *goofy*
			// in the DeviceName string. It will not compare correctly despite all common sense.
			// Best we can do is test for "ISPLAYV".
			return (scrn.DeviceName.ToUpper().IndexOf("ISPLAYV") >= 0);
		}
        void CreateControl(Screen current)
        {
            Type type = current.Type;

            // create new instance on gui thread
            if (MainControl.InvokeRequired)
            {
                MainControl.Invoke((MethodInvoker) delegate
                {
                    current.Control = (MyUserControl) Activator.CreateInstance(type);
                });
            }
            else
            {
                try
                {
                    current.Control = (MyUserControl) Activator.CreateInstance(type);
                }
                catch
                {
                    try
                    {
                        current.Control = (MyUserControl) Activator.CreateInstance(type);
                    }
                    catch
                    {
                    }
                }
            }

            // set the next new instance as not visible
            current.Control.Visible = false;
        }
        /// <summary>
        /// Takes a screenshot of the specified screens (and any screens between them)
        /// </summary>
        /// <param name="screens">The screens to take a screenshot of</param>
        /// <returns>A Image of the screenshot</returns>
        public static Image Grab(Screen[] screens)
        {
            if( screens == null )
                throw new ArgumentNullException("screens");

            if( screens.Length == 0 )
                throw new ArgumentException("Empty array", "screens");

            var start = new Point(0, 0);
            var end = new Point(0, 0);

            //get bounds of total screen space
            foreach( var tempScreen in screens )
            {
                if( tempScreen.Bounds.X < start.X )
                    start.X = tempScreen.Bounds.X;

                if( tempScreen.Bounds.Y < start.Y )
                    start.Y = tempScreen.Bounds.Y;

                if( tempScreen.Bounds.X + tempScreen.Bounds.Width > end.X )
                    end.X = tempScreen.Bounds.X + tempScreen.Bounds.Width;

                if( tempScreen.Bounds.Y + tempScreen.Bounds.Height > end.Y )
                    end.Y = tempScreen.Bounds.Y + tempScreen.Bounds.Height;
            }

            return Grab(start, end);
        }
        /// <summary>
        /// Takes a screenshot of the specified screen
        /// </summary>
        /// <param name="screen">The screen to take a screenshot of</param>
        /// <returns>A Image of the screenshot</returns>
        public static Image Grab(Screen screen)
        {
            if( screen == null )
                throw new ArgumentNullException("screen");

            return Grab(new[]{ screen });
        }
Beispiel #6
0
        private void AddPanel(Screen screen)
        {
            switch (screen)
            {
                case Screen.Product:
                    if (_UC_PRODUCT == null) _UC_PRODUCT = new UcDataProduct();
                    _USER_CONTROL = _UC_PRODUCT;
                    break;
                case Screen.Claim:
                    if (_UC_CLAIM == null) _UC_CLAIM = new UcClaim();
                    _USER_CONTROL = _UC_CLAIM;
                    break;
                case Screen.StockMonitor:
                    if (_UC_STOCK_MONITOR == null) _UC_STOCK_MONITOR = new UcStockMonitor();
                    _USER_CONTROL = _UC_STOCK_MONITOR;
                    break;
                case Screen.Report:
                    if (_UC_REPORT == null) _UC_REPORT = new UcReport();
                    _USER_CONTROL = _UC_REPORT;
                    break;
                case Screen.Member:
                    if (_UC_MEMBER == null) _UC_MEMBER = new UcMember();
                    _USER_CONTROL = _UC_MEMBER;
                    break;
            }

            if (!pnlMain.Contains(_USER_CONTROL))
            {
                pnlMain.Controls.Clear();
                _USER_CONTROL.Dock = DockStyle.Fill;
                pnlMain.Controls.Add(_USER_CONTROL);
            }
        }
        static Rectangle GetVisibleRectangle(WindowInfo wi, Screen s)
        {
            Rectangle resultWindowRect = new Rectangle(
                wi.rcWindow.left,
                wi.rcWindow.top,
                wi.rcWindow.right - wi.rcWindow.left,
                wi.rcWindow.bottom - wi.rcWindow.top
            );

            WindowBorderOnScreenFlags flags = new WindowBorderOnScreenFlags(wi, s);

            if(!flags.leftBorderOnScreen)
                resultWindowRect.X = s.WorkingArea.X;
            else {
                resultWindowRect.X = !flags.rightBorderOnScreen ?
                    s.WorkingArea.Right - wi.rcWindow.right + wi.rcWindow.left :
                    wi.rcWindow.left;
            }

            if(!flags.topBorderOnScreen)
                resultWindowRect.Y = s.WorkingArea.Y;
            else {
                resultWindowRect.Y = !flags.bottomBorderOnScreen ?
                    s.WorkingArea.Bottom - wi.rcWindow.bottom + wi.rcWindow.top :
                    wi.rcWindow.top;
            }

            return resultWindowRect;
        }
        public static Bitmap GetScreenBitmap(Screen screen, int ratio)
        {
            int sourceWidth = screen.Bounds.Width;
            int sourceHeight = screen.Bounds.Height;

            int destinationWidth = sourceWidth;
            int destinationHeight = sourceHeight;

            if (ratio < IMAGE_RESOLUTION_RATIO_MIN || ratio > IMAGE_RESOLUTION_RATIO_MAX) { ratio = 100; }

            float imageResolutionRatio = (float)ratio / 100;

            destinationWidth = (int)(sourceWidth * imageResolutionRatio);
            destinationHeight = (int)(sourceHeight * imageResolutionRatio);

            Bitmap bitmapSource = new Bitmap(sourceWidth, sourceHeight);
            Graphics graphicsSource = Graphics.FromImage(bitmapSource);
            graphicsSource.CopyFromScreen(screen.Bounds.X, screen.Bounds.Y, 0, 0, screen.Bounds.Size);

            Bitmap bitmapDestination = new Bitmap(destinationWidth, destinationHeight);
            Graphics graphicsDestination = Graphics.FromImage(bitmapDestination);
            graphicsDestination.DrawImage(bitmapSource, 0, 0, destinationWidth, destinationHeight);

            graphicsSource.Flush();
            graphicsDestination.Flush();

            return bitmapDestination;
        }
Beispiel #9
0
        // Check if we need to nudge the mosue down and by how much
        private bool NeedsNudge(Screen ActiveScreen, TabAlignment Dir, out Point NudgeAmount)
        {
            NudgeAmount = new Point(0, 0);

            if (Dir == TabAlignment.Left)
            {
                // Hack to get the screen to the left, I couldn't find any API call to get the layout of the screens so this should do for most cases
                Screen Left = Screen.FromPoint(new Point(Cursor.Position.X - ScreenNudgeMargin * 2, ActiveScreen.Bounds.Bottom - ActiveScreen.Bounds.Height / 2));

                if (Cursor.Position.Y <= Left.Bounds.Top)
                    NudgeAmount.Y = Left.Bounds.Top;
                else if (Cursor.Position.Y > Left.Bounds.Bottom)
                    NudgeAmount.Y = Left.Bounds.Bottom;
                else
                    return false;

                return true;
            }
            else if (Dir == TabAlignment.Right)
            {
                Screen Right = Screen.FromPoint(new Point(Cursor.Position.X + ScreenNudgeMargin * 2, ActiveScreen.Bounds.Bottom - ActiveScreen.Bounds.Height / 2));

                if (Cursor.Position.Y <= Right.Bounds.Top)
                    NudgeAmount.Y = Right.Bounds.Top;
                else if (Cursor.Position.Y > Right.Bounds.Bottom)
                    NudgeAmount.Y = Right.Bounds.Bottom;
                else
                    return false;

                return true;
            }

            return false;
        }
Beispiel #10
0
        /// <summary>
        /// Shows screen saver by creating one instance of Screen for each monitor.
        /// 
        /// Note: uses WinForms's Screen class to get monitor info.
        /// </summary>
        void ShowScreenSaver()
        {
            //creates window on primary screen
            Screen primaryWindow = new Screen();
            primaryWindow.WindowStartupLocation = WindowStartupLocation.Manual;
            System.Drawing.Rectangle location = WinForms.Screen.PrimaryScreen.Bounds;
            primaryWindow.WindowState = WindowState.Maximized;

            //creates window on other screens
            foreach (var screen in WinForms.Screen.AllScreens)
            {
                if (screen == WinForms.Screen.PrimaryScreen)
                    continue;

                var window = new Screen();
                window.WindowStartupLocation = WindowStartupLocation.Manual;
                location = screen.Bounds;

                //covers entire monitor
                window.Left = location.X - 7;
                window.Top = location.Y - 7;
                window.Width = location.Width + 14;
                window.Height = location.Height + 14;
            }

            //show non-primary screen windows
            foreach (var window in Current.Windows)
                if (window != primaryWindow)
                    window.Show();

            ///shows primary screen window last
            primaryWindow.Show();
        }
Beispiel #11
0
        public ScreenCapture(int fps, Screen screen)
        {
            string x = System.DateTime.Now.ToString();
            x = x.Replace(@"/", ".");
            x = x.Replace(@":", ".");

            strPath = @"/Videos/";

            intTop = screen.Bounds.X;
            intleft = screen.Bounds.Y;
            intWidth = screen.Bounds.Width;
            intHeight = screen.Bounds.Height;
            size = screen.Bounds.Size;

            capture();

            aviMan = new AviManager(x + ".avi", false);
            videoStream = aviMan.AddVideoStream(true, 30, printscreen);
            printscreen.Dispose();

            Console.WriteLine(strPath);
            System.IO.Directory.CreateDirectory(strPath);

            System.Timers.Timer aTimer;
            aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            aTimer.Interval = 1000 / fps;
            aTimer.Enabled = true;
        }
 private static Bitmap TakeScreenshot(Screen screen)
 {
     Bitmap bitmap = new Bitmap(screen.Bounds.Width, screen.Bounds.Height, PixelFormat.Format32bppArgb);
     Graphics graphics = Graphics.FromImage(bitmap);
     graphics.CopyFromScreen(screen.Bounds.X, screen.Bounds.Y, 0, 0, screen.Bounds.Size, CopyPixelOperation.SourceCopy);
     return bitmap;
 }
 public CursorControl(Screen screen, bool enabled, bool smooth)
 {
     GazeManager.Instance.AddGazeListener(this);
     ActiveScreen = screen;
     Enabled = enabled;
     Smooth = smooth;
 }
Beispiel #14
0
        public VirtualProjector(string name, string uuid, Size imageSize, PointF principal, double focalLength, Screen screen, Chessboard chessboard, CaptureCamera captureCamera)
            : base(name, uuid, imageSize, principal, focalLength, screen, chessboard, captureCamera)
        {
            OrbitCamera = new OrbitCamera("{0} Orbit".FormatWith(name), "N/A", imageSize, principal, focalLength,
                Intrinsics.NearPlaneDistance, Intrinsics.FarPlaneDistance) { Color = Color.DarkCyan.Alpha(0.7f), };
            Color = Color.DarkKhaki.Alpha(0.6f);
            
            ProgramTask.AttachInputToCamera(Program.WhenInput.Where(input => !input.KeyPressed(Keys.C)), Window, OrbitCamera);

            Program.WhenInput.Where(input => input.KeyDown(Keys.P)).Subscribe(input =>
            {
                var frustum = new Frustum(OrbitCamera, Intrinsics.ImageSize);

                var plane = new Plane(Vector3.UnitZ, 0);

                var p0 = frustum.IntersectWithPlane(ProjectorQuadCorners[0].X, ProjectorQuadCorners[0].Y, plane).ToPointF();
                var p1 = frustum.IntersectWithPlane(ProjectorQuadCorners[1].X, ProjectorQuadCorners[1].Y, plane).ToPointF();
                var p2 = frustum.IntersectWithPlane(ProjectorQuadCorners[2].X, ProjectorQuadCorners[2].Y, plane).ToPointF();
                var p3 = frustum.IntersectWithPlane(ProjectorQuadCorners[3].X, ProjectorQuadCorners[3].Y, plane).ToPointF();

                var quadCorners = new[] { p0, p1, p2, p3, };

                // Chessboard.HomographTo(quadCorners);
            });
        }
 /// <summary>
 /// Sizes to screen.
 /// </summary>
 /// <param name="screen">
 /// The screen.
 /// </param>
 public void SizeToScreen(Screen screen)
 {
     this.Left = screen.WorkingArea.Left;
     this.Top = screen.WorkingArea.Top;
     this.Width = screen.WorkingArea.Width;
     this.Height = screen.WorkingArea.Height;
 }
Beispiel #16
0
        public static Size SizeDialog(IDeviceContext dc, string mainInstruction, string content, Screen screen, Font mainInstructionFallbackFont, Font contentFallbackFont, int horizontalSpacing, int verticalSpacing, int minimumWidth, int textMinimumHeight)
        {
            int width = minimumWidth - horizontalSpacing;
            int height = GetTextHeight(dc, mainInstruction, content, mainInstructionFallbackFont, contentFallbackFont, width);

            while( height > width )
            {
                int area = height * width;
                width = (int)(Math.Sqrt(area) * 1.1);
                height = GetTextHeight(dc, mainInstruction, content, mainInstructionFallbackFont, contentFallbackFont, width);
            }

            if( height < textMinimumHeight )
                height = textMinimumHeight;

            int newWidth = width + horizontalSpacing;
            int newHeight = height + verticalSpacing;

            Rectangle workingArea = screen.WorkingArea;
            if( newHeight > 0.9 * workingArea.Height )
            {
                int area = height * width;
                newHeight = (int)(0.9 * workingArea.Height);
                height = newHeight - verticalSpacing;
                width = area / height;
                newWidth = width + horizontalSpacing;
            }

            // If this happens the text won't display correctly, but even at 800x600 you need
            // to put so much text in the input box for this to happen that I don't care.
            if( newWidth > 0.9 * workingArea.Width )
                newWidth = (int)(0.9 * workingArea.Width);

            return new Size(newWidth, newHeight);
        }
        public CalibrationWpf(Screen current)
        {
            InitializeComponent();
            screen = current;

            // Create the calibration target
            calibrationPointWpf = new CalibrationPointWpf(new Size(screen.Bounds.Width, screen.Bounds.Height));
            CalibrationCanvas.Children.Add(calibrationPointWpf);

            Opacity = 0;
            IsAborted = false;

            // Create the animation-out object and close form when completed
            animateOut = new DoubleAnimation(0, TimeSpan.FromSeconds(FADE_OUT_TIME))
            {
                From = 1.0,
                To = 0.0,
                AutoReverse = false
            };

            animateOut.Completed += delegate
            {
                Close();
            };
        }
        public DXGIScreen FindAdapter(Screen wscreen, bool refresh = false)
        {
            if (refresh) { this.Refresh(); }

            foreach (DXGIScreen screen in this.screens)
            {
                if (screen.Monitor.Description.Name.EndsWith(wscreen.DeviceName))
                {
                    return screen;
                }
            }

            //If not found force a refresh and try again
            if (!refresh) { this.Refresh(); }

            foreach (DXGIScreen screen in this.screens)
            {
                if (screen.Monitor.Description.Name.EndsWith(wscreen.DeviceName))
                {
                    return screen;
                }
            }

            //Blank object if not found
            return new DXGIScreen();
        }
 public double GetDpiX(Screen screen)
 {
     uint dpiX;
       uint dpiY;
       screen.GetDpi(DpiType.Effective, out dpiX, out dpiY);
       return Convert.ToDouble(dpiX);
 }
Beispiel #20
0
        public static void Register(Form form, AppBarEdge edge, Screen screen)
        {
            Rectangle screenArea = screen.WorkingArea;
            if (edge == AppBarEdge.Top || edge == AppBarEdge.Bottom)
            {
                form.Left = screenArea.Left;
                form.Width = screenArea.Width;
                form.Top = edge == AppBarEdge.Top ? screenArea.Top : screenArea.Bottom - form.Height;
            }
            else
            {
                form.Left = edge == AppBarEdge.Left ? screenArea.Left : screenArea.Right - form.Width;
                form.Height = screenArea.Height;
                form.Top = screenArea.Top;
            }
            form.FormBorderStyle = FormBorderStyle.None;
            uint callbackId = RegisterWindowMessage(form.GetHashCode().ToString("x"));

            APPBARDATA appData = new APPBARDATA();
            appData.cbSize = (uint)Marshal.SizeOf(appData);
            appData.uCallbackMessage = callbackId;
            appData.hWnd = form.Handle;

            uint ret = SHAppBarMessage(AppBarMessage.New, ref appData);
            if (ret != 0)
            {
                _appBars.Add(form);
                form.FormClosing += (s, e) => Unregister(form);
                AppBarPosition(form, edge, AppBarMessage.QueryPos);
                AppBarPosition(form, edge, AppBarMessage.SetPos);
            }
        }
Beispiel #21
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Shows the splash screen
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void Show(Screen display)
		{
#if !__MonoCS__
			if (m_thread != null)
				return;
#endif

			m_displayToUse = display;
			m_waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);

#if __MonoCS__
			// mono winforms can't create items not on main thread.
			StartSplashScreen(); // Create Modeless dialog on Main GUI thread
#else
			m_thread = new Thread(StartSplashScreen);
			m_thread.IsBackground = true;
			m_thread.SetApartmentState(ApartmentState.STA);
			m_thread.Name = "SplashScreen";
			// Copy the UI culture from the main thread to the splash screen thread.
			m_thread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
			m_thread.Start();
			m_waitHandle.WaitOne();
#endif

			Debug.Assert(m_splashScreen != null);
			Message = string.Empty;
		}
Beispiel #22
0
        public void AddScreen(Screen Screen)
        {
            // add to list
            screens.Add(Screen);

            // hide it
            Screen.Control.Visible = false;
        }
Beispiel #23
0
 public Bitmap TakeScreenshot(Screen currentScreen)
 {
     Graphics graph = null;
     var bmpScreenshot = new Bitmap(currentScreen.Bounds.Width, currentScreen.Bounds.Height, PixelFormat.Format32bppArgb);
     graph = Graphics.FromImage(bmpScreenshot);
     graph.CopyFromScreen(currentScreen.Bounds.X, currentScreen.Bounds.Y, 0,0,currentScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
     return bmpScreenshot;
 }
 public void SetLocation(Screen screen, Point applicationLocation, double applicationWidth, double applicationHeight)
 {
     const double pointsPerInch = 72.0;
       var pixelFactor = GetDpiX(screen) / pointsPerInch;
       var x = pixelFactor * applicationLocation.X + (pixelFactor * applicationWidth - Width) / 2;
       var y = pixelFactor * applicationLocation.Y + (pixelFactor * applicationHeight - Height) / 2;
       Location = new Point((int)x, (int)y);
 }
 public ScreenViewModel(Screen screen)
 {
     Screen = screen;
     ContentCollection.Add(new ImageContentViewModel(this));
     ContentCollection.Add(new RunFileContentViewModel(this));
     ContentCollection.Add(new VideoContentViewModel(this));
     Content = ContentCollection.FirstOrDefault();
 }
 internal ScreenInfo(ScreenInfoProvider.PartialScreenInfo partialScreenInfo, string friendlyName, Screen managedInfo)
 {
     this.DevicePath = partialScreenInfo.DevicePath;
     this.EDID = partialScreenInfo.EDID;
     this.InstanceId = partialScreenInfo.InstanceId;
     this.FriendlyName = friendlyName;
     this.ManagedInfo = managedInfo;
 }
Beispiel #27
0
		static void Main() {
			Timers timers = new Timers();
			Screen screen = new Screen();
			Keyboard keyboard = new Keyboard();
			Sound sound = new Sound();
			Chip8Emulator chip8 = new Chip8Emulator(timers, screen, keyboard, sound);
			Application.Run(new MainForm(chip8));
		}
        public void SetScreen(Screen screen)
        {
            StartPosition = FormStartPosition.Manual;

            var bounds = screen.Bounds;

            SetBounds(bounds.X, bounds.Y, bounds.Width, bounds.Height);
        }
        private D3DCursorWindow()
        {
            Settings.Default.PropertyChanged += SettingsChanged;
            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
            cursors = new List<D3DCursor>(2);
            mutex = new Mutex();

            primaryScreen = DeviceUtil.GetScreen(Settings.Default.primaryMonitor);
        }
    public static Window ToExtensionMaxScreen(this Window window, Winform.Screen extScreen)
    {
        if (extScreen.Primary)
        {
            window.WindowState = WindowState.Maximized;
        }
        window.WindowStartupLocation = WindowStartupLocation.Manual;
        System.Drawing.Rectangle mswa = extScreen.WorkingArea;
        window.Left   = mswa.Left;
        window.Top    = mswa.Top;
        window.Width  = mswa.Width;
        window.Height = mswa.Height;

        return(window);
    }
Beispiel #31
0
        public void Application_Startup(object sender, StartupEventArgs e)
        {
            //            base.OnStartup(e);

            MainWindow mainWindow = new MainWindow();

            mainWindow.Show();

            if (System.Windows.Forms.Screen.AllScreens.Count() > 1)
            {
                w2 = new SecondWindow();
                s2 = System.Windows.Forms.Screen.AllScreens[1];
            }
            LoadData();
        }
Beispiel #32
0
        /// <summary>
        /// 设置手术排班大屏显示布局
        /// </summary>
        private void SetScreenLayout()
        {
            System.Windows.Forms.Screen scr = System.Windows.Forms.Screen.PrimaryScreen;
            Rectangle rc = scr.Bounds;

            if (ExtendAppContext.Current.IsTV)
            {
                screenPnlRight.Width = rc.Width * 5 / 9;
            }
            else
            {
                screenPnlRight.Width = 0;
            }
            //计算并设置各控件的高度
            ScreenCtrHelper.CalculateCtrsHeight(rc.Height);
            screenTopPnl.Height       = ExtendAppContext.Current.TopBottomHeight;
            screenBottomPnl.Height    = ExtendAppContext.Current.TopBottomHeight;
            normalContentTitle.Height = ExtendAppContext.Current.RowHeight;
            //一般显示内容
            normalColsList = ScreenCtrHelper.GetNormalColumnList(this.normalContentArea.Width * 0.95);
            //手术信息显示字体大小
            ExtendAppContext.Current.ContentFontSize = MedicalSystem.MedScreen.Controls.ControlHelper.GetFontSizeByHeight(ExtendAppContext.Current.RowHeight * 0.6F, "微软雅黑");
            //大屏标签(标题)字体
            LabelFont            = new Font("微软雅黑", MedicalSystem.MedScreen.Controls.ControlHelper.GetFontSizeByHeight(screenPnlLabel.Height * 0.8F, "微软雅黑"));
            screenPnlLabel.Width = (int)(this.CreateGraphics().MeasureString(ExtendAppContext.Current.ScreenLabel, LabelFont).Width * 1.1);
            //日期时间显示字体
            DateTimeFont = new Font("微软雅黑", MedicalSystem.MedScreen.Controls.ControlHelper.GetFontSizeByHeight(screenPnlTime.Height * 0.5F, "微软雅黑"));
            //公告信息
            MsgFont   = new Font("微软雅黑", MedicalSystem.MedScreen.Controls.ControlHelper.GetFontSizeByHeight((float)ExtendAppContext.Current.TopBottomHeight * 0.7F, "微软雅黑"));
            msgStartX = rc.Width * 5 / 6;
            msgCurntX = msgStartX;
            msgCurntY = (ExtendAppContext.Current.TopBottomHeight - this.CreateGraphics().MeasureString("我", MsgFont).Height) / 2;
            msgStep   = this.CreateGraphics().MeasureString("1", MsgFont).Width / 4;
            if (ExtendAppContext.Current.IsTV)
            {
                screenPnlRight.Controls.Clear();
                mediaPlayerCtr mediaPlay = new mediaPlayerCtr();
                mediaPlay.Parent = screenPnlRight;
                mediaPlay.Dock   = DockStyle.Fill;
            }
            else
            {
                screenPnlRight.Controls.Clear();
                normalRightFrm rightFrm = new normalRightFrm();
                rightFrm.Parent = screenPnlRight;
                rightFrm.Dock   = DockStyle.Fill;
            }
        }
Beispiel #33
0
        /// <summary>
        /// Center form on screen
        /// </summary>
        /// <param name="frm"></param>

        public static void CenterFormOnScreen(Form frm)
        {
            // Get the Width and Height of the form
            int frm_width  = frm.Width;
            int frm_height = frm.Height;

            //Get the Width and Height (resolution) of the screen
            System.Windows.Forms.Screen src = System.Windows.Forms.Screen.PrimaryScreen;
            int src_height = src.Bounds.Height;
            int src_width  = src.Bounds.Width;

            //put the form in the center
            frm.Left = (src_width - frm_width) / 2;
            frm.Top  = (src_height - frm_height) / 2;
            return;
        }
Beispiel #34
0
        private void Form1_Load(object sender, EventArgs e)
        {
            AllocConsole();
            int frm_width  = this.Width;
            int frm_height = this.Height;

            System.Windows.Forms.Screen src = System.Windows.Forms.Screen.PrimaryScreen;
            int src_height = src.Bounds.Height;
            int src_width  = src.Bounds.Width;

            this.Left = ((src_width - frm_width) / 2) + 100;
            //this.Top = (src_height - frm_height) / 2;
            ////Console.WriteLine("Jai Ganesh");

            LoadTemplates();
        }
Beispiel #35
0
 public ScreenEx(Forms.Screen screen, ScreenSettingsDevMode devMode)
 {
     this.DeviceName    = screen.DeviceName;
     this.BitsPerPixel  = (byte)screen.BitsPerPixel;
     this.Bounds        = new Rectangle(screen.Bounds.Location, screen.Bounds.Size);
     this.Primary       = screen.Primary;
     this.SpecVersion   = devMode.dmSpecVersion;
     this.DriverVersion = devMode.dmDriverVersion;
     this.FixedOutput   = (FixedOutput)devMode.dmDisplayFixedOutput;
     this.LogPixels     = devMode.dmLogPixels;
     this.ColorDepth    = (ColorDepth)devMode.dmBitsPerPel;
     this.DisplayFlags  = devMode.dmDisplayFlags;
     this.Frequency     = (byte)devMode.dmDisplayFrequency;
     this.Orientation   = (ScreenOrientation)devMode.dmDisplayOrientation;
     this.fields        = 0;
 }
        private void MenuItem_SetupTime(object sender, RoutedEventArgs e)
        {
            SetupTimeWin Win_SetupTime = new SetupTimeWin(this);

            // Get the first not Primary Screen
            swf.Screen showMainScreen = Utility.Detect_oneNonPrimaryScreen();
            // Show the  MainWindow on the Touch Screen
            sd.Rectangle Rect_showMainScreen = showMainScreen.Bounds;
            Win_SetupTime.Top  = Rect_showMainScreen.Top;
            Win_SetupTime.Left = Rect_showMainScreen.Left;

            // Set Owner
            Win_SetupTime.Owner = this;

            Win_SetupTime.Show();
        }
Beispiel #37
0
        /// <summary>
        /// Gets the resolution of the display device associated with the screen.
        /// </summary>
        /// <param name="screen">The Windows Forms screen object associated with the display device.</param>
        /// <returns>A struct having the screen, display device width, and display device height.</returns>
        public static DeviceResolution GetDeviceResolution(System.Windows.Forms.Screen screen)
        {
            DEVMODE dm = new DEVMODE();

            dm.dmSize = (short)Marshal.SizeOf(typeof(DEVMODE));
            EnumDisplaySettings(screen.DeviceName, ENUM_CURRENT_SETTINGS, ref dm);

            DeviceResolution deviceResolution = new DeviceResolution()
            {
                screen = screen,
                width  = dm.dmPelsWidth,
                height = dm.dmPelsHeight
            };

            return(deviceResolution);
        }
Beispiel #38
0
        public void SetForm_Capture()
        {
            int width  = 0;
            int height = 0;
            int minX   = int.MaxValue;
            int minY   = int.MaxValue;

            // 全ディスプレイの幅と高さをそれぞれ合計
            //System.Windows.Forms.Screen s = System.Windows.Forms.Screen.PrimaryScreen;
            System.Windows.Forms.Screen leftup_s = System.Windows.Forms.Screen.PrimaryScreen;
            foreach (System.Windows.Forms.Screen s in System.Windows.Forms.Screen.AllScreens)
            {
                height = height + s.Bounds.Height;
                width  = width + s.Bounds.Width;
                if (s.Bounds.X < minX)
                {
                    minX     = s.Bounds.X;
                    leftup_s = s;
                }
                if (s.Bounds.Y < minY)
                {
                    minY     = s.Bounds.Y;
                    leftup_s = s;
                }
            }

            // 画面の高さと幅をグローバル変数に設定
            ClsCapture.dHeight = height;
            ClsCapture.dWidth  = width;

            //左上座標を設定
            ClsCapture.minX = minX;
            ClsCapture.minY = minY;

            FormCaptureSheet fc = new FormCaptureSheet();

            // 'キャプチャウィンドウの位置と大きさの設定
            FormCaptureSheet fCaptureSheet = new FormCaptureSheet();

            fCaptureSheet.Opacity       = 0.4;
            fCaptureSheet.StartPosition = FormStartPosition.Manual;
            fCaptureSheet.Location      = leftup_s.Bounds.Location;
            fCaptureSheet.Width         = width;
            fCaptureSheet.Height        = height;
            fCaptureSheet.ShowDialog();
        }
Beispiel #39
0
        private void btnTestTouchpadJuicer_Click(object sender, RoutedEventArgs e)
        {
            TestStartpadJuicerWin Win_TestStartpadJuicer = new TestStartpadJuicerWin(this)
            {
                // Set Owner
                Owner = this
            };

            // Get the first not Primary Screen
            swf.Screen showMainScreen = Utility.Detect_oneNonPrimaryScreen();
            // Show the  MainWindow on the Touch Screen
            sd.Rectangle Rect_showMainScreen = showMainScreen.WorkingArea;
            Win_TestStartpadJuicer.Top  = Rect_showMainScreen.Top;
            Win_TestStartpadJuicer.Left = Rect_showMainScreen.Left;

            Win_TestStartpadJuicer.Show();
        }
Beispiel #40
0
        private static void OpenFormOnSpecificMonitor(Form formToOpen, System.Windows.Forms.Screen screen,
                                                      ref Point point, ref Size size, bool hideFromTaskBar, bool hideFromAltTab, bool runAsUIThread)
        {
            // Set the StartPosition to Manual otherwise the system will assign an automatic start position
            formToOpen.StartPosition = FormStartPosition.Manual;
            // Set the form location so it appears at Location (x, y) on the specified screen
            var l = screen.Bounds.Location;

            l.Offset(point);
            formToOpen.DesktopLocation = l;
            // Show the form
            formToOpen.Size = size;
            if (runAsUIThread)
            {
                Application.UseWaitCursor    = false;
                Application.VisualStyleState = VisualStyleState.NoneEnabled;
                Application.Run(formToOpen);
            }
            else
            {
                formToOpen.Show();
                formToOpen.UseWaitCursor = false;
                formToOpen.Cursor        = Cursors.Default;
            }
            formToOpen.Size  = size;
            formToOpen.Owner = Application.OpenForms.Count == 0 ? null : Application.OpenForms[0];
            if (hideFromTaskBar)
            {
                formToOpen.ShowInTaskbar = false;
            }
            if (hideFromAltTab)
            {
                formToOpen.ShowIcon      = false;
                formToOpen.ShowInTaskbar = false;
            }
            if (hideFromAltTab)
            {
                NativeMethods.SetWindowLong(formToOpen.Handle, NativeMethods.GWL_EXSTYLE,
                                            (NativeMethods.GetWindowLong(formToOpen.Handle,
                                                                         NativeMethods.GWL_EXSTYLE) |
                                             NativeMethods.WS_EX_TOOLWINDOW) & ~NativeMethods.WS_EX_APPWINDOW);
            }
        }
Beispiel #41
0
        public static bool IsForegroundFullScreen(System.Windows.Forms.Screen screen)
        {
            if (screen == null)
            {
                screen = System.Windows.Forms.Screen.PrimaryScreen;
            }
            RECT2  rect = new RECT2();
            IntPtr hWnd = (IntPtr)GetForegroundWindow();

            GetWindowRect(new HandleRef(null, hWnd), ref rect);
            if (screen.Bounds.Width == (rect.right - rect.left) && screen.Bounds.Height == (rect.bottom - rect.top))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #42
0
        private void UpdatePreviewImage(ScreenCapture screenCapture)
        {
            try
            {
                if (checkBoxActive.Checked)
                {
                    if (comboBoxScreenComponent.SelectedIndex == 0)
                    {
                        pictureBoxPreview.Image = screenCapture.GetActiveWindowBitmap();
                    }
                    else
                    {
                        System.Windows.Forms.Screen screen = GetScreenByIndex(comboBoxScreenComponent.SelectedIndex);

                        pictureBoxPreview.Image = screen != null
                            ? screenCapture.GetScreenBitmap(
                            screen.Bounds.X,
                            screen.Bounds.Y,
                            screen.Bounds.Width,
                            screen.Bounds.Height,
                            (int)numericUpDownResolutionRatio.Value,
                            checkBoxMouse.Checked
                            )
                            : null;
                    }

                    UpdatePreviewMacro();
                }
                else
                {
                    pictureBoxPreview.Image = null;

                    textBoxMacroPreview.ForeColor = System.Drawing.Color.White;
                    textBoxMacroPreview.BackColor = System.Drawing.Color.Black;
                    textBoxMacroPreview.Text      = "[Active option is off. No screenshots of this screen will be taken during a running screen capture session]";
                }
            }
            catch (Exception ex)
            {
                Log.WriteExceptionMessage("FormScreen::UpdatePreview", ex);
            }
        }
Beispiel #43
0
        public OverlayWindow(Forms.Screen screen)
        {
            InitializeComponent();

            log.Trace("Initializing Overlay");

            screenRect = screen.WorkingArea;

            vm = new OverlayViewModel();
            this.DataContext = vm;



            this.SourceInitialized += OverlayWindow_SourceInitialized;
            this.Loaded            += OverlayWindow_Loaded;
            this.Activated         += OverlayWindow_Activated;

            AppService.Instance.OnToggleOverlayVisibility += AppService_OnToggleOverlayVisibility;
            AppService.Instance.OnResetDefaultOverlay     += AppService_OnResetDefaultOverlay;
        }
        public static Forms.Screen GetScreen(this Forms.NotifyIcon icon)
        {
            Interop.NOTIFYICONIDENTIFIER identifier;

            Forms.Screen screen = null;

            screen = TryGetNotifyIconIdentifier(icon, out identifier)
                                ? Forms.Screen.FromHandle(identifier.hWnd)
                                : Application.Current.MainWindow.GetScreen();

            if (screen == null)
            {
                Logger.WriteLine(Logger.Level.Debug, "NotifyIcon",
                                 "Cannot get screen from NotifyIcon so defaulting to PrimaryScreen");

                screen = Forms.Screen.PrimaryScreen;
            }

            return(screen);
        }
Beispiel #45
0
        private void UpdatePreview()
        {
            if (comboBoxScreenComponent.SelectedIndex == 0) // Active Window
            {
                pictureBoxScreenPreview.Image = ScreenCapture.GetActiveWindowBitmap();
            }
            else // Screen 1, 2, 3, etc.
            {
                System.Windows.Forms.Screen screen = ScreenDictionary[comboBoxScreenComponent.SelectedIndex];

                pictureBoxScreenPreview.Image = ScreenCapture.GetScreenBitmap(
                    screen.Bounds.X,
                    screen.Bounds.Y,
                    screen.Bounds.Width,
                    screen.Bounds.Height,
                    (int)numericUpDownScreenResolutionRatio.Value,
                    checkBoxScreenMouse.Checked
                    );
            }
        }
Beispiel #46
0
 private void SetWindowState(FormWindowState state, bool setSize)
 {
     if (state == FormWindowState.Maximized)
     {
         this.IsMaximized = true;
         if (setSize)
         {
             this.previousPosition = this.Bounds;
         }
         this.WindowState     = FormWindowState.Normal;
         this.FormBorderStyle = FormBorderStyle.None;
         this.Location        = Point.Empty;
         this.Size            = Screen.FromHandle(this.Handle).Bounds.Size;
     }
     else
     {
         this.FormBorderStyle = FormBorderStyle.Sizable;
         this.Bounds          = this.previousPosition;
         this.IsMaximized     = false;
     }
 }
Beispiel #47
0
        public static uint GetDpi(this System.Windows.Forms.Screen screen)
        {
            if (!MonitorDpiSupported)
            {
                // fallback to slow method if we can't get the dpi from the system
                using (var form = new System.Windows.Forms.Form {
                    Bounds = screen.Bounds
                })
                    using (var graphics = form.CreateGraphics())
                    {
                        return((uint)graphics.DpiY);
                    }
            }

            var  pnt = new System.Drawing.Point(screen.Bounds.Left + 1, screen.Bounds.Top + 1);
            var  mon = MonitorFromPoint(pnt, MONITOR.DEFAULTTONEAREST);
            uint dpiX, dpiY;

            GetDpiForMonitor(mon, MDT.EFFECTIVE_DPI, out dpiX, out dpiY);
            return(dpiX);
        }
Beispiel #48
0
        private void UpdatePreview()
        {
            if (comboBoxScreenComponent.SelectedIndex == 0)
            {
                pictureBoxPreview.Image = ScreenCapture.GetActiveWindowBitmap();
            }
            else
            {
                System.Windows.Forms.Screen screen = GetScreenByIndex(comboBoxScreenComponent.SelectedIndex);

                pictureBoxPreview.Image = screen != null
                    ? ScreenCapture.GetScreenBitmap(
                    screen.Bounds.X,
                    screen.Bounds.Y,
                    screen.Bounds.Width,
                    screen.Bounds.Height,
                    (int)numericUpDownResolutionRatio.Value,
                    checkBoxMouse.Checked
                    )
                    : null;
            }
        }
Beispiel #49
0
        /// <summary>
        /// 设置手术排班大屏显示布局
        /// </summary>
        private void SetScreenLayout()
        {
            System.Windows.Forms.Screen scr = System.Windows.Forms.Screen.PrimaryScreen;
            Rectangle rc = scr.Bounds;

            screenPnlSequence.Visible = ExtendAppContext.Current.SeqMode;
            //计算并设置各控件的高度
            ScreenCtrHelper.CalculateCtrsHeight(rc.Height);
            screenTopPnl.Height       = ExtendAppContext.Current.TopBottomHeight;
            screenBottomPnl.Height    = ExtendAppContext.Current.TopBottomHeight;
            normalPnlTop.Height       = ExtendAppContext.Current.RowHeight;
            normalContentTitle.Height = ExtendAppContext.Current.RowHeight;
            seqPnlTop.Height          = ExtendAppContext.Current.RowHeight;
            seqContentTitle.Height    = ExtendAppContext.Current.RowHeight;

            //若接台展示
            if (ExtendAppContext.Current.SeqMode)
            {
                screenPnlSequence.Width = rc.Width / 3;
                seqColsList             = ScreenCtrHelper.GetSeqColumnList(this.seqContentArea.Width * 0.95);
            }
            //一般显示内容
            normalColsList = ScreenCtrHelper.GetNormalColumnList(this.screenPnlNormal.Width * 0.95);
            //手术信息显示字体大小
            ExtendAppContext.Current.ContentFontSize = ExtendAppContext.Current.SeqMode ?
                                                       MedicalSystem.MedScreen.Controls.ControlHelper.GetFontSizeByHeight(ExtendAppContext.Current.RowHeight * 0.5F, "微软雅黑") : MedicalSystem.MedScreen.Controls.ControlHelper.GetFontSizeByHeight(ExtendAppContext.Current.RowHeight * 0.6F, "微软雅黑");

            //大屏标签(标题)字体
            LabelFont            = new Font("微软雅黑", MedicalSystem.MedScreen.Controls.ControlHelper.GetFontSizeByHeight(screenPnlLabel.Height * 0.8F, "微软雅黑"));
            screenPnlLabel.Width = (int)(this.CreateGraphics().MeasureString(ExtendAppContext.Current.ScreenLabel, LabelFont).Width * 1.1);
            //日期时间显示字体
            DateTimeFont = new Font("微软雅黑", MedicalSystem.MedScreen.Controls.ControlHelper.GetFontSizeByHeight(screenPnlTime.Height * 0.5F, "微软雅黑"));
            //公告信息
            MsgFont   = new Font("微软雅黑", MedicalSystem.MedScreen.Controls.ControlHelper.GetFontSizeByHeight((float)ExtendAppContext.Current.TopBottomHeight * 0.7F, "微软雅黑"));
            msgStartX = rc.Width * 5 / 6;
            msgCurntX = msgStartX;
            msgCurntY = (ExtendAppContext.Current.TopBottomHeight - this.CreateGraphics().MeasureString("我", MsgFont).Height) / 2;
            msgStep   = this.CreateGraphics().MeasureString("1", MsgFont).Width / 4;
        }
Beispiel #50
0
        protected override void OnLoad(EventArgs e)
        {
            System.Windows.Forms.Screen sc = Screen.FromHandle(this.Handle);


            Int32 x; Int32 y;

            x = sc.WorkingArea.Width - this.Width;
            y = sc.WorkingArea.Height - this.Height;
            if (sc.WorkingArea.Location.X != 0)
            {
                x = sc.WorkingArea.Location.X + sc.WorkingArea.Width - this.Width;
                y = sc.WorkingArea.Location.Y + sc.WorkingArea.Height - this.Height;
            }


            this.Location    = new Point(x, y);
            lblLocation.Text = string.Format("x:{0}\ry:{1}", sc.WorkingArea.Location.X, sc.WorkingArea.Location.Y);
            ZS.Common.Win32.API.AnimateWindow(this.Handle, 200, Win32.API.AnimateWindowType.AW_HOR_NEGATIVE);
            //ZS.Common.Win32.API.AnimateWindow(this.Handle, 500, (Int32)(Win32.API.AnimateWindowType.AW_ACTIVATE) + (Int32)Win32.API.AnimateWindowType.AW_BLEND);
            //ZS.Common.Win32.API.AnimateWindow(this.Handle, 1000, (Int32)(Win32.API.AnimateWindowType.AW_VER_NEGATIVE) + (Int32)Win32.API.AnimateWindowType.AW_HOR_NEGATIVE);
        }
Beispiel #51
0
        public Deck(string serverAddress, int serverPort, Guid bubbleId, string location, string identityProviderUrl, string participantName, string participantPassphrase)
        {
            System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.FromHandle(Window.Handle);
            AssemblyName assemblyName          = this.GetType().Assembly.GetName();

            this.Window.Title             = "MX Deck " + assemblyName.Version + " - Interactive Bubble Bouncer Demo";
            this.Window.AllowUserResizing = false;
            this.IsMouseVisible           = true;

            engine = new DeckEngine(
                serverAddress,
                serverPort,
                bubbleId,
                location,
                identityProviderUrl,
                participantName,
                participantPassphrase, this);

            AvatarName = participantName;

            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            //graphics.SynchronizeWithVerticalRetrace = true;
            //graphics.PreferMultiSampling = true;
            //graphics.IsFullScreen = true;
            graphics.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);



            //graphics.PreferredBackBufferWidth = 320;
            //graphics.PreferredBackBufferHeight = 240;
            graphics.PreferredBackBufferWidth  = screen.Bounds.Width * 5 / 6;
            graphics.PreferredBackBufferHeight = screen.Bounds.Height * 5 / 6;

            //graphics.MinimumVertexShaderProfile = ShaderProfile.VS_2_0;
            //graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;
        }
Beispiel #52
0
 public static void OpenFormOnSpecificMonitor(Form formToOpen,
                                              System.Windows.Forms.Screen screen, Point point, Size size,
                                              bool hideFromTaskBar, bool hideFromAltTab,
                                              bool runAsUIThread)
 {
     OpenFormOnSpecificMonitor(formToOpen, screen, point, size);
     if (hideFromTaskBar)
     {
         formToOpen.ShowInTaskbar = false;
     }
     if (hideFromAltTab)
     {
         formToOpen.ShowIcon      = false;
         formToOpen.ShowInTaskbar = false;
     }
     if (hideFromAltTab)
     {
         NativeMethods.SetWindowLong(formToOpen.Handle, NativeMethods.GWL_EXSTYLE,
                                     (NativeMethods.GetWindowLong(formToOpen.Handle,
                                                                  NativeMethods.GWL_EXSTYLE) |
                                      NativeMethods.WS_EX_TOOLWINDOW) & ~NativeMethods.WS_EX_APPWINDOW);
     }
 }
Beispiel #53
0
    public void init(int display = 0, bool fullscreen = false)
    {
        if (display > System.Windows.Forms.Screen.AllScreens.Length)
        {
            display    = 0;
            fullscreen = false;
        }

        source = GameObject.Find("WebcamDisplay");
        if (fullscreen)
        {
            System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.AllScreens[display];
            p1 = new Vector2Int(screen.Bounds.X, screen.Bounds.Y + 2);
            p2 = new Vector2Int(screen.Bounds.Width, screen.Bounds.Height);
        }
        else
        {
            p1 = new Vector2Int(0, 0);
            p2 = new Vector2Int(320, 500);
        }

        setWindowPosition(p1.x, p1.y, p2.x, p2.y);
    }
Beispiel #54
0
        public void ShowImageList(Item[] items)
        {
            this.HideImageList();
            this.comboBox.Items.AddRange(items);
            using (IDrawingContext context = DrawingContext.CreateNull(FactorySource.PerThread))
            {
                this.DetermineMaxItemSize(context, items, out this.itemSize, out this.maxImageSize);
            }
            this.comboBox.ItemHeight    = this.itemSize.Height;
            this.comboBox.DropDownWidth = (this.itemSize.Width + SystemInformation.VerticalScrollBarWidth) + UIUtil.ScaleWidth(2);
            System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.FromControl(this);
            PointInt32 num  = this.PointToScreen(new PointInt32(this.comboBox.Left, this.comboBox.Bottom));
            int        num2 = screen.WorkingArea.Height - num.Y;

            num2  = this.itemSize.Height * (num2 / this.itemSize.Height);
            num2 += 2;
            int num3 = 2 + (this.itemSize.Height * 3);
            int num4 = Math.Max(num2, num3);

            this.comboBox.DropDownHeight = num4;
            int num5 = Array.FindIndex <Item>(items, item => item.Selected);

            this.comboBox.SelectedIndex = num5;
            int x = this.PointToScreen(new PointInt32(0, base.Height)).X;

            if ((x + this.comboBox.DropDownWidth) > screen.WorkingArea.Right)
            {
                x = screen.WorkingArea.Right - this.comboBox.DropDownWidth;
            }
            PointInt32 num7 = this.PointToClient(new PointInt32(x, num.Y));

            base.SuspendLayout();
            this.comboBox.Left = num7.X;
            base.ResumeLayout(false);
            this.comboBox.Focus();
            UIUtil.ShowComboBox(this.comboBox, true);
        }
Beispiel #55
0
        public Form1()
        {
            try
            {
                InitializeComponent();
                System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.PrimaryScreen;
                int w = this.Width;
                //int x = screen.Bounds.Width - w;
                int x = screen.Bounds.Width / 2;
                this.Location     = new Point(x, 0);
                fearesgb.Visible  = false;
                RunGB.Visible     = false;
                ResultsGB.Visible = false;
                FeaFileTB.Visible = false;
                installDir        = System.IO.Directory.GetCurrentDirectory() + "\\";
                if (installDir.StartsWith("C:\\Users\\rich\\Documents\\Visual Studio 2013"))
                {
                    installDir = "C:\\Users\\rich\\Documents\\stressrefineWorking\\";
                }

                workingDir = installDir;
                logName    = workingDir + "srui.log";
                feaFolder  = workingDir;
                ReadConfig();
                ReadSettings();
                SRDefFolder = workingDir + "SRFiles\\";
                if (!Directory.Exists(SRDefFolder))
                {
                    Directory.CreateDirectory(SRDefFolder);
                }
                //note: translator, engine, and cgx have to be in installdir.
            }
            catch
            {
                shutdown();
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            taskName = "GoNogo";


            // Get the first not Primary Screen
            swf.Screen showMainScreen = Utility.Detect_oneNonPrimaryScreen();
            // Show the  MainWindow on the Touch Screen
            sd.Rectangle Rect_showMainScreen = showMainScreen.Bounds;
            this.Top  = Rect_showMainScreen.Top;
            this.Left = Rect_showMainScreen.Left;


            // Check serial Port IO8 Connection
            CheckIO8Connection();


            // Load Default Config File
            LoadConfigFile("defaultConfig");

            if (textBox_NHPName.Text != "" && serialPortIO8_name != null)
            {
                btn_start.IsEnabled = true;
                btn_stop.IsEnabled  = false;
            }
            else
            {
                btn_start.IsEnabled = false;
                btn_stop.IsEnabled  = false;
            }


            // Get the touch Screen Rectangle
            swf.Screen PrimaryScreen = swf.Screen.PrimaryScreen;
            Rect_touchScreen = PrimaryScreen.Bounds;
        }
Beispiel #57
0
        private Screen(WinForms.Screen wfScreen)
        {
            if (wfScreen == null)
            {
                throw new ArgumentNullException("wfScreen");
            }
            _original = wfScreen;

            if (Environment.OSVersion.Platform == PlatformID.Win32NT &&
                Environment.OSVersion.Version >= Windows8)
            {
                var monitor = NativeMethods.MonitorFromPoint(
                    new System.Drawing.Point((int)WorkingArea.Left, (int)WorkingArea.Top), 2);
                NativeMethods.GetDpiForMonitor(monitor, DpiType.Effective, out _dpiX, out _dpiY);
            }
            else
            {
                var g       = Graphics.FromHwnd(IntPtr.Zero);
                var desktop = g.GetHdc();

                _dpiX = (uint)NativeMethods.GetDeviceCaps(desktop, (int)DeviceCap.LOGPIXELSX);
                _dpiY = (uint)NativeMethods.GetDeviceCaps(desktop, (int)DeviceCap.LOGPIXELSY);
            }
        }
Beispiel #58
0
 internal ScreenService(System.Windows.Forms.Screen screen)
 {
     this.screen = screen;
 }
Beispiel #59
0
        private void doScreenshot(object sender, System.EventArgs e)
        {
            System.Drawing.Bitmap       b;
            System.Drawing.Graphics     g;
            System.Windows.Forms.Screen scr = null;
            if (System.Windows.Forms.Screen.AllScreens.Length > 1)
            {
                using (ChooseScreenDialog csd = new ChooseScreenDialog())
                {
                    if (csd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        scr = csd.ChoosenScreen;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else
            {
                scr = System.Windows.Forms.Screen.PrimaryScreen;
            }

            ParentForm.Visible = false;
            System.Windows.Forms.Application.DoEvents();
            System.Threading.Thread.Sleep(200);
            System.Windows.Forms.Application.DoEvents();

            if (scr == null)
            {
                int max_x = 0, max_y = 0, min_x = 0, min_y = 0;
                foreach (System.Windows.Forms.Screen screen in System.Windows.Forms.Screen.AllScreens)
                {
                    if (screen.Bounds.Top + screen.Bounds.Height > max_y)
                    {
                        max_y = screen.Bounds.Top + screen.Bounds.Height;
                    }
                    if (screen.Bounds.Left + screen.Bounds.Width > max_x)
                    {
                        max_x = screen.Bounds.Left + screen.Bounds.Width;
                    }
                    if (screen.Bounds.Top < min_y)
                    {
                        min_y = screen.Bounds.Top;
                    }
                    if (screen.Bounds.Left < min_x)
                    {
                        min_x = screen.Bounds.Left;;
                    }
                }
                b = new System.Drawing.Bitmap(max_x + min_x * -1, max_y + min_y * -1);
                g = System.Drawing.Graphics.FromImage(b);
                g.CopyFromScreen(min_x, min_y, 0, 0, b.Size);
            }
            else
            {
                b = new System.Drawing.Bitmap(scr.Bounds.Width, scr.Bounds.Height);
                g = System.Drawing.Graphics.FromImage(b);
                g.CopyFromScreen(scr.Bounds.Left, scr.Bounds.Top, 0, 0, b.Size);
            }

            ParentForm.Visible = true;
            g.Dispose();
            pictureBox1.Image = b;
        }
Beispiel #60
-1
        private void AddPanel(Screen screen)
        {
            switch (screen)
            {
                case Screen.Sale:
                    if (_UC_SALE == null) _UC_SALE = new UcSale();
                    _USER_CONTROL = _UC_SALE;
                    break;
                case Screen.ReceiveProduct:
                    if (_UC_RECEIVE_PRODUCT == null) _UC_RECEIVE_PRODUCT = new UcReceiveProduct();
                    _USER_CONTROL = _UC_RECEIVE_PRODUCT;
                    break;
                case Screen.Stock:
                    if (_UC_STOCK == null) _UC_STOCK = new UcStock();
                    _USER_CONTROL = _UC_STOCK;
                    break;
            }

            if (!panelMain.Contains(_USER_CONTROL))
            {
                panelMain.Controls.Clear();
                _USER_CONTROL.Dock = DockStyle.Fill;
                panelMain.Controls.Add(_USER_CONTROL);
            }
        }