日期:2014-05-16  浏览次数:20820 次

C# 学习写控件时一直没效果。。。
本帖最后由 zdczdcc 于 2014-03-13 16:33:26 编辑

生成控件,可是没效果,连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();