日期:2014-05-16 浏览次数:20885 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace _自定义按钮
{
public partial class transparentButton : UserControl
{
public transparentButton()
{
InitializeComponent();
}
#region 公共字段
public static SmoothingMode sMode;
public static bool btClick = true;
public static int pub_degree = 20;//四个角弧度的大小范围
#endregion
#region 属性
private int TcornerDegree = 2;
[Browsable(true), Category("按钮的属性设置"), Description("按钮四个角的弧度")]
public int cornerDegree
{
get { return TcornerDegree; }
set {
TcornerDegree = value;
if (this.Width > this.Height)
pub_degree = (int)(this.Height / 2);
else
pub_degree = (int)(this.Width) / 2;
if (TcornerDegree <= 0)
TcornerDegree = 1;
if (TcornerDegree> pub_degree)
TcornerDegree = pub_degree;
if (TcornerDegree > 0)
this.Invalidate();