12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
网站建设 时间:2024-11-27 18:41:45
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
在WinForm中设置按钮的形状可以通过自定义按钮控件的方式来实现。以下是一种常用的方法:创建一个自定义按钮控件类,继承自Button类:using System;using System.Drawing;using S
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
在WinForm中设置按钮的形状可以通过自定义按钮控件的方式来实现。以下是一种常用的方法:
using System;using System.Drawing;using System.Windows.Forms;public class RoundButton : Button{protected override void OnPaint(PaintEventArgs pevent){GraphicsPath path = new GraphicsPath();path.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height);this.Region = new System.Drawing.Region(path);base.OnPaint(pevent);}}
RoundButton roundButton = new RoundButton();roundButton.Text = "Round Button";roundButton.Size = new Size(100, 100);this.Controls.Add(roundButton);
通过以上步骤,就可以创建一个圆形的按钮控件并在Form中使用了。您也可以根据具体需求,自定义不同形状的按钮控件。
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19