Winform圆形环绕的Loading动画实现代码
本文导语: 之前写了一个WPF的圆形环绕的Loading动画,现在写一个Winform的圆形环绕的Loading动画。 1.新建Winform项目,添加一个pictureBox控件,命名为:pictureBox; 2.引用中添加using System.Drawing.Drawing2D; 3.Form窗体命名为:Loading,cs全部代码如下...
之前写了一个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; i
您可能感兴趣的文章:
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。