示例#1
0
        public RegionCaptureForm(RegionCaptureMode mode)
        {
            Mode = mode;

            ScreenRectangle       = CaptureHelpers.GetScreenBounds();
            ScreenRectangle0Based = CaptureHelpers.ScreenToClient(ScreenRectangle);
            ImageRectangle        = ScreenRectangle0Based;

            InitializeComponent();

            Config                 = new RegionCaptureOptions();
            DrawableObjects        = new List <DrawableObject>();
            timerStart             = new Stopwatch();
            timerFPS               = new Stopwatch();
            colorBlinkAnimation    = new ColorBlinkAnimation();
            shapeTypeTextAnimation = new TextAnimation(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(0.5));

            borderPen    = new Pen(Color.Black);
            borderDotPen = new Pen(Color.White)
            {
                DashPattern = new float[] { 5, 5 }
            };
            nodeBackgroundBrush    = new SolidBrush(Color.White);
            infoFont               = new Font("Verdana", 9);
            infoFontMedium         = new Font("Verdana", 12);
            infoFontBig            = new Font("Verdana", 16, FontStyle.Bold);
            textBackgroundBrush    = new SolidBrush(Color.FromArgb(75, Color.Black));
            textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White));
            textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black));
            markerPen              = new Pen(Color.FromArgb(200, Color.Red));
        }
示例#2
0
        private void DrawTextAnimation(Graphics g, TextAnimation textAnimation)
        {
            Size      textSize      = g.MeasureString(textAnimation.Text, infoFontMedium).ToSize();
            int       padding       = 3;
            Rectangle textRectangle = new Rectangle(textAnimation.Position.X, textAnimation.Position.Y, textSize.Width + padding * 2, textSize.Height + padding * 2);

            using (Brush backgroundBrush = new SolidBrush(Color.FromArgb((int)(textAnimation.Opacity * 175), Color.FromArgb(44, 135, 206))))
                using (Pen outerBorderPen = new Pen(Color.FromArgb((int)(textAnimation.Opacity * 175), Color.White)))
                    using (Pen innerBorderPen = new Pen(Color.FromArgb((int)(textAnimation.Opacity * 175), Color.FromArgb(0, 81, 145))))
                        using (Brush textBrush = new SolidBrush(Color.FromArgb((int)(textAnimation.Opacity * 255), Color.White)))
                            using (Brush textShadowBrush = new SolidBrush(Color.FromArgb((int)(textAnimation.Opacity * 255), Color.Black)))
                            {
                                DrawInfoText(g, textAnimation.Text, textRectangle, infoFontMedium, padding, backgroundBrush, outerBorderPen, innerBorderPen, textBrush, textShadowBrush);
                            }
        }
示例#3
0
        private void DrawTextAnimation(Graphics g, TextAnimation textAnimation)
        {
            Size textSize = g.MeasureString(textAnimation.Text, infoFontMedium).ToSize();
            int padding = 3;
            Rectangle textRectangle = new Rectangle(textAnimation.Position.X, textAnimation.Position.Y, textSize.Width + padding * 2, textSize.Height + padding * 2);

            using (Brush backgroundBrush = new SolidBrush(Color.FromArgb((int)(textAnimation.Opacity * 175), Color.FromArgb(44, 135, 206))))
            using (Pen outerBorderPen = new Pen(Color.FromArgb((int)(textAnimation.Opacity * 175), Color.White)))
            using (Pen innerBorderPen = new Pen(Color.FromArgb((int)(textAnimation.Opacity * 175), Color.FromArgb(0, 81, 145))))
            using (Brush textBrush = new SolidBrush(Color.FromArgb((int)(textAnimation.Opacity * 255), Color.White)))
            using (Brush textShadowBrush = new SolidBrush(Color.FromArgb((int)(textAnimation.Opacity * 255), Color.Black)))
            {
                DrawInfoText(g, textAnimation.Text, textRectangle, infoFontMedium, padding, backgroundBrush, outerBorderPen, innerBorderPen, textBrush, textShadowBrush);
            }
        }