C# 学习写控件时一直没效果。解决方案
C# 学习写控件时一直没效果。。。
生成控件,可是没效果,连Text都看不见,和设计时候默认的那个UserControl一样,请问哪出了问题
生成控件,可是没效果,连Text都看不见,和设计时候默认的那个UserControl一样,请问哪出了问题
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();
}
}
private Color TshineColor = Color.Red;
[Browsable(true), Category("按钮的属性设置"), Description("按钮的光泽度颜色")]
public Color shineColor
{
get { return TshineColor; }
set
{
TshineColor = value;
this.Invalidate();
}
}
private int TtranparentDegree = 2;
[Browsable(true), Category("按钮的属性设置"), Description("按钮的透明度数")]
public int transparentDegree
{
get { return TtranparentDegree; }
set{TtranparentDegree=value;
if(TtranparentDegree>20)
TtranparentDegree=20;
if(TtranparentDegree<0)