【请教】C# 中椭圆Button怎么做出来啊??

Strawberry0924 2011-12-02 10:32:44
小弟,不怎么会C#,不知道在C#中椭圆的Button怎么做出来。

有谁知道,请赐教。谢谢。

效果如下:
...全文
337 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
c02645 2011-12-03
  • 打赏
  • 举报
回复
有点击事件的控件基本都可以做,效果不一
youzelin 2011-12-03
  • 打赏
  • 举报
回复
直接在 Form 的 Paint 事件里面用 e.Graphics.DrawEllipse 方法画就行了
dingshanwei123 2011-12-03
  • 打赏
  • 举报
回复
找个图片,把图片做成按钮 可以点就根按钮一样
youzelin 2011-12-03
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 denqh 的回复:]

有上百种方法可以做出这个
[/Quote]

请举出前 50 种!
startstartsvip 2011-12-03
  • 打赏
  • 举报
回复
用 wpf 的 Ellipse

http://msdn.microsoft.com/en-us/library/aa970268.aspx
kevin083916 2011-12-03
  • 打赏
  • 举报
回复
直接用图片不行么,把图片做成椭圆的
dylike 2011-12-03
  • 打赏
  • 举报
回复
运行后
dylike 2011-12-03
  • 打赏
  • 举报
回复
运行前


运行后
[img=]http://p13.freep.cn/p.aspx?u=v20_p1_photo_1112031314208970_0.jpg[/img]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim B As New Bitmap(Button1.Width, Button1.Height)
Using G As Graphics = Graphics.FromImage(B)
G.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
Using Gp As New Drawing2D.GraphicsPath
'绘制从边缘向内收缩4像素的椭圆
Gp.AddEllipse(New Rectangle(4, 4, Button1.Width - 8, Button1.Height - 8))
'设置按钮形状为该椭圆形状
Button1.Region = New Region(Gp)
'填充渐变
G.FillPath(New Drawing2D.LinearGradientBrush(New Point(4, 4), New Point(4, Button1.Height), Color.Yellow, Color.Red), Gp)
'描绘椭圆边框
G.DrawEllipse(New Pen(Brushes.Black, 3), New Rectangle(4, 4, Button1.Width - 8, Button1.Height - 8))
End Using
End Using
With Button1
'设置为其背景,不影响Image属性
.BackgroundImage = B
'取消难看的自有边框
.FlatAppearance.BorderSize = 0
'使用“抬起”效果是为了使按钮文字有点击响应视觉
.FlatStyle = FlatStyle.Popup
End With
End Sub

Strawberry0924 2011-12-02
  • 打赏
  • 举报
回复
只设置Image属性就可以了吗????
mizuho_2006 2011-12-02
  • 打赏
  • 举报
回复
设置image属性
Strawberry0924 2011-12-02
  • 打赏
  • 举报
回复
求解。。。。
Strawberry0924 2011-12-02
  • 打赏
  • 举报
回复
DENQH 2011-12-02
  • 打赏
  • 举报
回复
有上百种方法可以做出这个

110,561

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧