Gif之上动态显示数据

又是大佬拿来的代码,修修改改就能用了。单纯记录

using System;
using System.Drawing;
using System.Windows.Forms;
using DSAPI.神扩展;
using static DSAPI.神扩展.神扩展;
using System.Threading.Tasks;
using System.Threading;
using System.Drawing.Text;

namespace CustomHexagonProgressBar
{
    public partial class HexagonProgressBarEx : Form
    {
        private Form OverlayForm = new Form();

        public HexagonProgressBarEx()
        {
            InitializeComponent();
        }
        public delegate void del(string str);
        private void HexagonProgressBarEx_Load(object sender, EventArgs e) 
        {
            this.设置鼠标拖动();
            var _with1 = OverlayForm;
            _with1.FormBorderStyle = FormBorderStyle.None;
            _with1.Size = new Size(40, 40);
            _with1.Owner = this;
            _with1.Show();
            _with1.BringToFront();
            _with1.居中();
            _with1.Location = new Point(932, 500);
            _with1.TopMost = false;
            _with1.跟随宿主窗体移动(this);
            _with1.ShowInTaskbar = false;

            Task.Factory.StartNew(() =>
            {
                for (int i = 1; i <= 99; i++)
                {
                    this.委托执行(() =>
                    {
                        this.ShowDigit($"{i}/99");
                    });
                    Thread.Sleep(1000);
                }
            });
        }

        public void ShowDigit(string digit)
        {
            using (Bitmap bit = new Bitmap(54, 54))
            {
                using (Graphics graphics = Graphics.FromImage(bit))
                {
                    using (StringFormat sf = new StringFormat())
                    {
                        sf.Alignment = StringAlignment.Center;
                        sf.LineAlignment = StringAlignment.Center;
                        graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
                        graphics.DrawString(digit, new Font("微软雅黑", 10), Brushes.White, new Rectangle(0, 0, 54, 54), sf);
                    }
                }
                OverlayForm.透明窗体样式显示图像(bit);
            }
        }
    }
}

在这里插入图片描述
在这里插入图片描述
还需要调用大佬的dll。但是这里要咋放放上去不懂。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值