| 
 | 
 
 
 楼主 |
发表于 2013-5-17 15:31:09
|
显示全部楼层
 
 
 
[code=csharp]        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)  //画圆角窗体,圆角半径5 
        { 
            GraphicsPath path = new GraphicsPath(); 
 
            int x = 0; 
            int y = 0; 
            int width = this.Width; 
            int height = this.Height; 
            int a = 10; 
 
            Graphics graphic = CreateGraphics(); 
            path.AddArc(x, y, a, a, 180, 90); 
            path.AddArc(width - a, y, a, a, 270, 90); 
            path.AddArc(width - a, height - a, a, a, 0, 90); 
            path.AddArc(x, height - a, a, a, 90, 90); 
            path.CloseAllFigures(); 
 
            //Region region = new Region(path); 
            this.Region = new Region(path); 
        }[/code] 
 
下面是我写的测试代码 
[code=csharp]        private void button1_Click(object sender, EventArgs e) 
        { 
            Label label = new Label(); 
            label.AutoSize = true; 
            label.BackColor = Color.Transparent; 
            label.ForeColor = Color.LimeGreen; 
            label.Font = new Font("微软雅黑", 12, FontStyle.Regular); 
            label.Text = "服务器"; 
 
            this.tableLayoutPanel1.Controls.Add(label); 
        }[/code] |   
 
 
 
 |