Winform圆形环绕的Loading动画
程序员文章站
2022-04-14 10:15:00
之前写了一个wpf的圆形环绕的loading动画,现在写一个winform的圆形环绕的loading动画。
1.新建winform项目,添加一个picturebox控件,命名为:picturebox...
之前写了一个wpf的圆形环绕的loading动画,现在写一个winform的圆形环绕的loading动画。
1.新建winform项目,添加一个picturebox控件,命名为:picturebox;
2.引用中添加using system.drawing.drawing2d;
3.form窗体命名为:loading,cs全部代码如下:
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.collections; using system.drawing.drawing2d; namespace circle_processbar { public partial class loading : form { private int count = -1; private arraylist images = new arraylist(); public bitmap[] bitmap = new bitmap[8]; private int _value = 1; private color _circlecolor = color.red; private float _circlesize = 0.8f; public loading() { initializecomponent(); } public color circlecolor { get { return _circlecolor; } set { _circlecolor = value; invalidate(); } } public float circlesize { get { return _circlesize; } set { if (value 4.0f ? 4.0f : value; invalidate(); } } public bitmap drawcircle(int j) { const float angle = 360.0f / 8; bitmap map = new bitmap(150, 150); graphics g = graphics.fromimage(map); g.translatetransform(width / 2.0f, height / 2.0f); g.rotatetransform(angle * _value); g.interpolationmode = interpolationmode.highqualitybicubic; g.smoothingmode = smoothingmode.antialias; int[] a = new int[8] { 25, 50, 75, 100, 125, 150, 175, 200 }; for (int i = 1; i4.效果如图:
上一篇: oracle数据库学习之角色VS权限、SQL结构化查询语言
下一篇: 云计算中Hive基本语法解析