Пример #1
0
        private void DrawFPS(Graphics g)
        {
            string text = "FPS: " + FPS;

            SizeF textSize = g.MeasureString(text, infoFontBig);

            int offset = 10;

            Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
            Rectangle textRectangle       = new Rectangle(primaryScreenBounds.X + offset, primaryScreenBounds.Y + offset, (int)textSize.Width, (int)textSize.Height);

            if (textRectangle.Offset(10).Contains(InputManager.MousePosition0Based))
            {
                textRectangle.Y = primaryScreenBounds.Height - textRectangle.Height - offset;
            }

            ImageHelpers.DrawTextWithOutline(g, text, textRectangle.Location, infoFontBig, Color.White, Color.Black);
        }
        private void DrawTips(Graphics g, int offset, int padding)
        {
            StringBuilder sb = new StringBuilder();

            WriteTips(sb);
            string tipText = sb.ToString().Trim();

            Size      textSize            = g.MeasureString(tipText, infoFont).ToSize();
            int       rectWidth           = textSize.Width + padding * 2 + 2;
            int       rectHeight          = textSize.Height + padding * 2;
            Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
            Rectangle textRectangle       = new Rectangle(primaryScreenBounds.X + primaryScreenBounds.Width - rectWidth - offset, primaryScreenBounds.Y + offset, rectWidth, rectHeight);

            if (textRectangle.Offset(10).Contains(CurrentMousePosition0Based))
            {
                textRectangle.Y = primaryScreenBounds.Height - rectHeight - offset;
            }

            DrawInfoText(g, tipText, textRectangle, padding);
        }
Пример #3
0
        private void DrawTips(Graphics g)
        {
            int offset  = 10;
            int padding = 3;

            string tipText;

            if (isDrawingMode)
            {
                tipText = "Ctrl: Region mode ░ Shift: Pen color ░ Mouse wheel: Pen size ░ Space: Fullscreen capture";
            }
            else
            {
                tipText = "Ctrl: Drawing mode ░ Space: Fullscreen capture";
            }

            Size      textSize            = g.MeasureString(tipText, tipFont).ToSize();
            int       rectWidth           = textSize.Width + padding * 2;
            int       rectHeight          = textSize.Height + padding * 2;
            Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
            Rectangle textRectangle       = new Rectangle(primaryScreenBounds.X + (primaryScreenBounds.Width / 2) - (rectWidth / 2), primaryScreenBounds.Y + offset, rectWidth, rectHeight);

            if (textRectangle.RectangleOffset(10).Contains(CurrentMousePosition0Based))
            {
                textRectangle.Y = primaryScreenBounds.Height - rectHeight - offset;
            }

            using (Brush brush = new SolidBrush(Color.FromArgb(175, Color.White)))
                using (Pen pen = new Pen(Color.FromArgb(175, Color.Black)))
                {
                    g.DrawRoundedRectangle(brush, pen, textRectangle, 5);
                }

            using (StringFormat sf = new StringFormat {
                Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center
            })
            {
                g.DrawString(tipText, tipFont, Brushes.Black, textRectangle, sf);
            }
        }
Пример #4
0
        private void DrawTips(Graphics g, int offset, int padding)
        {
            StringBuilder sb = new StringBuilder();

            WriteTips(sb);
            string tipText = sb.ToString().Trim();

            Size      textSize            = g.MeasureString(tipText, infoFont).ToSize();
            int       rectWidth           = textSize.Width + padding * 2 + 2;
            int       rectHeight          = textSize.Height + padding * 2;
            Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
            Rectangle textRectangle       = new Rectangle(primaryScreenBounds.X + primaryScreenBounds.Width - rectWidth - offset, primaryScreenBounds.Y + offset, rectWidth, rectHeight);

            if (textRectangle.Offset(10).Contains(InputManager.MousePosition0Based))
            {
                textRectangle.Y = primaryScreenBounds.Height - rectHeight - offset;
            }

            g.FillRectangle(textBackgroundBrush, textRectangle.Offset(-2));
            g.DrawRectangleProper(textBackgroundPenBlack, textRectangle.Offset(-1));
            g.DrawRectangleProper(textBackgroundPenWhite, textRectangle);

            ImageHelpers.DrawTextWithShadow(g, tipText, textRectangle.Offset(-padding).Location, infoFont, Brushes.White, Brushes.Black);
        }