日期:2014-05-17  浏览次数:20886 次

请教一下, 怎样让用户自定义控件实现背景透明.特别是当多个控件重叠时.
现在运行时的效果下如图:


请问, 怎样让控件白色的部份变为透明呢? 

        #region 透明
        public bool drag = false;
        public bool enab = false;
        private Color fillColor = Color.White;
        private int opacity = 100;

        public Color FillColor
        {
            get
            {
                return this.fillColor;
            }
            set
            {
                this.fillColor = value;
                if (this.Parent != null) Parent.Invalidate(this.Bounds, true);
            }
        }

        public int Opacity
        {
            get
            {
                if (opacity > 100) { opacity = 100; }
                else if (opacity < 1) { opacity = 1; }
                return this.opacity;
            }
            set
            {
                this.opacity = value;
                if (this.Parent != null) Parent.Invalidate(this.Bounds, true);