RoundcornerForm 圆角窗口

HuronControl.RoundcornerForm()

功能:圆角窗口(WinForm,无边框窗口最佳)

该控件继承自System.Windows.Forms

 

代码:

public RoundcornerForm()  
{  
    this.Paint += new PaintEventHandler(RoundcornerForm_Paint);  
}  
  
private void RoundcornerForm_Paint(object sender, PaintEventArgs e)  
{  
    List<Point> list = new List<Point>();  
    int width = this.Width;  
    int height = this.Height;  
  
    //左上   
    list.Add(new Point(0, 5));  
    list.Add(new Point(1, 5));  
    list.Add(new Point(1, 3));  
    list.Add(new Point(2, 3));  
    list.Add(new Point(2, 2));  
    list.Add(new Point(3, 2));  
    list.Add(new Point(3, 1));  
    list.Add(new Point(5, 1));  
    list.Add(new Point(5, 0));  
  
    //右上   
    list.Add(new Point(width - 5, 0));  
    list.Add(new Point(width - 5, 1));  
    list.Add(new Point(width - 3, 1));  
    list.Add(new Point(width - 3, 2));  
    list.Add(new Point(width - 2, 2));  
    list.Add(new Point(width - 2, 3));  
    list.Add(new Point(width - 1, 3));  
    list.Add(new Point(width - 1, 5));  
    list.Add(new Point(width - 0, 5));  
  
    //右下   
    list.Add(new Point(width - 0, height - 5));  
    list.Add(new Point(width - 1, height - 5));  
    list.Add(new Point(width - 1, height - 3));  
    list.Add(new Point(width - 2, height - 3));  
    list.Add(new Point(width - 2, height - 2));  
    list.Add(new Point(width - 3, height - 2));  
    list.Add(new Point(width - 3, height - 1));  
    list.Add(new Point(width - 5, height - 1));  
    list.Add(new Point(width - 5, height - 0));  
  
    //左下   
    list.Add(new Point(5, height - 0));  
    list.Add(new Point(5, height - 1));  
    list.Add(new Point(3, height - 1));  
    list.Add(new Point(3, height - 2));  
    list.Add(new Point(2, height - 2));  
    list.Add(new Point(2, height - 3));  
    list.Add(new Point(1, height - 3));  
    list.Add(new Point(1, height - 5));  
    list.Add(new Point(0, height - 5));  
  
    Point[] points = list.ToArray();  
  
    GraphicsPath shape = new GraphicsPath();  
    shape.AddPolygon(points);  
  
    this.Region = new System.Drawing.Region(shape);  
}  


 

应用范围推荐:载入中显示窗口,桌面贴片

实例:

 

LoadingCircle_Marquee LoadingCircle_Step

仿Apple半透明Loading控件

窗口构造

// WinForm 实例 frmFlag   
  
private LoadingCircle loadingCircle = new HuronControl.LoadingCircle();  
  
// loadingCircle   
this.loadingCircle.BackColor = System.Drawing.Color.DimGray;  
this.loadingCircle.InnerCircleRadius = 15;  
this.loadingCircle.LineWidth = 3;  
this.loadingCircle.Name = "loadingCircle";  
this.loadingCircle.OutnerCircleRadius = 40;  
this.loadingCircle.Speed = 100;  
this.loadingCircle.SpokesMember = 15;  
this.loadingCircle.ThemeColor = System.Drawing.Color.White;  
  
// frmFlag   
this.BackColor = System.Drawing.Color.DimGray;  
this.Controls.Add(this.loadingCircle);  
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;  
this.MaximizeBox = false;  
this.MinimizeBox = false;  
this.Name = "frmFlag";  
this.Opacity = 0.8D;  
this.ShowIcon = false;  
this.TopMost = true;  


控制方法

int steps = 100; //总步数   
int step = 0; //当前进度   
  
//步进方式   
//步进开始   
loadingCircle.StartStep(steps);  
//步进到...(建议配合线程或Timer使用)   
loadingCircle.PerformStep(step);  
  
//循环方式   
loadingCircle1.StartMarquee();  


注:若使用线程控制loadingCircle步进,需要使用委托,类似如下

this.BeginInvoke(new EventHandler(PerformStep));  


 来自:http://blog.csdn.net/huronzhu/article/details/6981647

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值