WinFrom透明Label

        //构造函数

        public from1()
        {
            InitializeComponent();
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
        }

      //图片框重绘函数

        private void pictureBox2_Paint(object sender, PaintEventArgs e)
        {
            foreach (Control c in this.Controls)
            {
                if (c is Label)
                {
                    Label l = (Label)c;
                    l.Visible = false;
                    e.Graphics.DrawString(l.Text, l.Font, new SolidBrush(l.ForeColor), l.Left - pictureBox2.Left, l.Top - pictureBox2.Top);
                }
            }
        }

posted on 2009-03-18 15:41  QZB.NET  阅读(254)  评论(0编辑  收藏  举报