请问下button按钮可否改为方的
如题,若能改,告之改法,谢谢
程序代码:using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public class RoundButton : System.Windows.Forms.Button
{
public RoundButton()
{
Rectangle rec = this.ClientRectangle;
rec.Size = new Size(50,50);
rec.X += 3;
rec.Y += 3;
using (GraphicsPath p = new GraphicsPath())
{
p.AddPie(rec,0f,360f);
this.Region = new Region(p);
}
}
}
}
程序代码: private void InitializeComponent()
{
this.roundButton1 = new WindowsFormsApplication2.RoundButton();
this.SuspendLayout();
this.roundButton1.BackColor = System.Drawing.Color.Red;
this.roundButton1.Location = new System.Drawing.Point(34, 21);
this.roundButton1.Name = "roundButton1";
this.roundButton1.Size = new System.Drawing.Size(57, 57);
this.roundButton1.TabIndex = 0;
this.roundButton1.UseVisualStyleBackColor = false;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.roundButton1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}