C#中改变按钮的形状!

 我来答
ahcc08
2014-04-14 · 知道合伙人软件行家
ahcc08
知道合伙人软件行家
采纳数:11853 获赞数:51932
拥有丰富的软件开发经验。

向TA提问 私信TA
展开全部
使用Region属性。
先创建GraphicsPath对像,在其中实现一个形状,然后应用于控件的region属性.
例如创建圆形按钮:
private void roundButton_Paint(object sender, PaintEventArgs e)
{
   System.Drawing.Drawing2D.GraphicsPath buttonPath =  new System.Drawing.Drawing2D.GraphicsPath();
  System.Drawing.Rectangle newRectangle = roundButton.ClientRectangle;
  newRectangle.Inflate(-10, -10);
  e.Graphics.DrawEllipse(System.Drawing.Pens.Black, newRectangle);
  newRectangle.Inflate( 1,  1);
  buttonPath.AddEllipse(newRectangle);.
  roundButton.Region = new System.Drawing.Region(buttonPath);
}
阳光的雷咩咩
2016-01-27 · TA获得超过1.4万个赞
知道大有可为答主
回答量:2.3万
采纳率:66%
帮助的人:7553万
展开全部
用WPF没有?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式