Пример #1
0
        private void DrawShadowText(Graphics gfx, Font font, IBrush brush, Point pt, string txt)
        {
            var bpPt = new Point(pt.X - 1, pt.Y + 1);

            //var bpPt2 = new Point(pt.X + 1, pt.Y - 1);
            gfx.DrawText(font, _txtBrush, bpPt, txt);
            //gfx.DrawText(font, _txtBrush, bpPt2, txt);
            gfx.DrawText(font, brush, pt, txt);
        }
Пример #2
0
        private void DrawShadowText(Graphics gfx, Font font, float fontSize, IBrush brush, Point pt, string txt)
        {
            var bpPt = new Point();

            bpPt.X = pt.X - 1;
            bpPt.Y = pt.Y + 1;
            gfx.DrawText(font, fontSize, _txtBrush, bpPt, txt);
            gfx.DrawText(font, fontSize, brush, pt, txt);
        }
Пример #3
0
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            try
            {
                Graphics gfx = e.Graphics;
                if (_window.X != config.Overlay_x || _window.Y != config.Overlay_y || _window.Width != config.Overlay_width || _window.Height != config.Overlay_height)
                {
                    _window.X      = config.Overlay_x;
                    _window.Y      = config.Overlay_y;
                    _window.Width  = config.Overlay_width;
                    _window.Height = config.Overlay_height;
                    _window.Recreate();
                }

                if (_fonts["consolas"].FontSize != config.Overlay_FontSize)
                {
                    SetOverlayFonts();
                }

                var infoText = new StringBuilder().ToString();
                foreach (string s in LastLines)
                {
                    string newLine = $"{s}\r\n";
                    Point  p       = gfx.MeasureString(_fonts["consolas"], config.Overlay_FontSize, newLine);

                    if (p.X > _window.Width)
                    {
                        string newLines = "";
                        newLine = s;

                        float ratio     = _window.Width / p.X;
                        float part      = p.X / _window.Width;
                        float lenString = ratio * newLine.Length;

                        for (int i = 1; i < part + 1; i++)
                        {
                            float lenNewLines = (newLine.Length < lenString ? newLine.Length - 1 : (int)lenString);;
                            newLines += $"{newLine.Substring(0, (int)lenNewLines)}\r\n";
                            newLine   = newLine[(int)lenNewLines..];