Hefried在圆角上的帖子 [英] Hefried's post on Rounded Corners

查看:108
本文介绍了Hefried在圆角上的帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Herfried:


回过头来,你发布了一种非常酷的方式来绕过表格的角落。我认为我已经把它保存了下来,但如果你有方便的话,请你发布它吗?

TIA,


比尔


-

亲切地说,


WG Ryan
做******** @ comcast.nospam.net
www.devbuzz.com
www.knowdotnet.com

解决方案




这里我是怎么做的。

Private Sub Form1_Paint(ByVal sender As Object,ByVal e As

System.Windows.Forms.PaintEventArgs)处理MyBase.Paint


Dim gp As GraphicsPath = New GraphicsPath


Dim radius As Single


radius = 25


gp.AddLine(半径,0,宽度 - (半径* 2),0)


gp.AddArc(宽度 - (半径* 2), 0,半径* 2,半径* 2,270,90)


gp.AddLine(宽度,半径,宽度,高度 - (半径* 2))

gp.AddArc(宽度 - (半径* 2),高度 - (半径* 2),半径* 2,半径*

2,0,90)

gp.AddLine(宽度 - (半径* 2),高度,半径,高度)


gp.AddArc(0,高度 - (半径* 2),半径* 2,半径* 2,90,90)


gp.AddLine(0,高度 - (半径* 2),0,半径)

gp.AddArc(0,0,半径* 2,半径* 2,180,90)


gp.CloseFigure()


Dim regRoundRect As New Region(gp)

>
Me.Region = regRoundRect


End Sub


Ken

----- -------------

" William Ryan" <做******** @ nospam.comcast.net>在消息中写道

新闻:OB ************** @ TK2MSFTNGP09.phx.gbl ...

Herfried:

前段时间你发布了一个非常酷的方式来绕过一个表格的角落。
我认为我把它保存了下来,但是如果你有它的方便,你会不会发布
它?
TIA,

比尔

-
亲切地说,

WG Ryan
< a href =mailto:do ******** @ comcast.nospam.net>做******** @ comcast.nospam.net
www.devbuzz.com
www.knowdotnet.com



谢谢Ken!

" Ken Tucker [MVP]" < VB *** @ bellsouth.net>在消息中写道

新闻:uV ************** @ tk2msftngp13.phx.gbl ...


以下是我的工作方式。
Private Sub Form1_Paint(ByVal sender As Object,ByVal e As
System.Windows.Forms.PaintEventArgs)处理MyBase.Paint


Dim radius As Single

半径= 25

gp.AddLine(半径,0,宽度 - (半径* 2),0)

gp.AddArc(宽度 - (半径* 2),0,半径* 2,半径* 2,270,90)

gp.AddLine(宽度,半径,宽度,高度 - (半径* 2))

gp.AddArc(宽度 - (半径* 2),高度 - (半径* 2),半径* 2,半径
* 2,0,90)

gp.AddLine(宽度 - (半径* 2),高度,半径,高度)

gp.AddArc( 0,高度 - (半径* 2),半径* 2,半径* 2,90,90)

gp.AddLine(0,高度 - (半径* 2),0,半径)

gp.AddArc(0,0,半径* 2,半径* 2,180,90)

gp.CloseFigure()

Dim regRoundRect为新区域(gp)

结束子

Ken
--- ---------------
William Ryan <做******** @ nospam.comcast.net>在消息中写道
新闻:OB ************** @ TK2MSFTNGP09.phx.gbl ...

Herfried:
前段时间你发布了一个非常酷的方式绕过
表格的角落。我认为我把它保存了下来,但如果你有方便的话,请你发帖吗?
TIA,

比尔
-
亲切地,

WG Ryan
做** ******@comcast.nospam.net
www.devbuzz。 com
www.knowdotnet.com




" Ken Tucker [MVP]" < VB *** @ bellsouth.net>写道......


我永远无法抗拒乱码...人们可能会考虑定义直径

并避免一些相同的乘法


Dim radius As Single = 25

Dim diameter As Single =(radius * 2)


gp.AddLine(radius, 0,宽度 - 直径,0)

gp.AddArc(宽度 - 直径,0,直径,直径,270,90)


等。 />

Herfried:

A while back you posted a really cool way to round the corners of a form. I
thought I had it saved, but if you have it handy, would you kindly post it?
TIA,

Bill

--
Cordially,

W.G. Ryan
do********@comcast.nospam.net
www.devbuzz.com
www.knowdotnet.com

解决方案

Hi,

Here is how i do it.
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

Dim gp As GraphicsPath = New GraphicsPath

Dim radius As Single

radius = 25

gp.AddLine(radius, 0, Width - (radius * 2), 0)

gp.AddArc(Width - (radius * 2), 0, radius * 2, radius * 2, 270, 90)

gp.AddLine( Width, radius, Width, Height - (radius * 2))

gp.AddArc(Width - (radius * 2), Height - (radius * 2), radius * 2, radius *
2, 0, 90)

gp.AddLine(Width - (radius * 2), Height, radius, Height)

gp.AddArc(0, Height - (radius * 2), radius * 2, radius * 2, 90, 90)

gp.AddLine(0, Height - (radius * 2), 0, radius)

gp.AddArc(0, 0, radius * 2, radius * 2, 180, 90)

gp.CloseFigure()

Dim regRoundRect As New Region(gp)

Me.Region = regRoundRect

End Sub

Ken
------------------
"William Ryan" <do********@nospam.comcast.net> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...

Herfried:

A while back you posted a really cool way to round the corners of a form.
I
thought I had it saved, but if you have it handy, would you kindly post
it?
TIA,

Bill

--
Cordially,

W.G. Ryan
do********@comcast.nospam.net
www.devbuzz.com
www.knowdotnet.com



Thanks Ken!
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uV**************@tk2msftngp13.phx.gbl...

Hi,

Here is how i do it.
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

Dim gp As GraphicsPath = New GraphicsPath

Dim radius As Single

radius = 25

gp.AddLine(radius, 0, Width - (radius * 2), 0)

gp.AddArc(Width - (radius * 2), 0, radius * 2, radius * 2, 270, 90)

gp.AddLine( Width, radius, Width, Height - (radius * 2))

gp.AddArc(Width - (radius * 2), Height - (radius * 2), radius * 2, radius * 2, 0, 90)

gp.AddLine(Width - (radius * 2), Height, radius, Height)

gp.AddArc(0, Height - (radius * 2), radius * 2, radius * 2, 90, 90)

gp.AddLine(0, Height - (radius * 2), 0, radius)

gp.AddArc(0, 0, radius * 2, radius * 2, 180, 90)

gp.CloseFigure()

Dim regRoundRect As New Region(gp)

Me.Region = regRoundRect

End Sub

Ken
------------------
"William Ryan" <do********@nospam.comcast.net> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...

Herfried:

A while back you posted a really cool way to round the corners of a form. I
thought I had it saved, but if you have it handy, would you kindly post
it?
TIA,

Bill

--
Cordially,

W.G. Ryan
do********@comcast.nospam.net
www.devbuzz.com
www.knowdotnet.com




"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote...

I can never resist messing with code... one might consider defining diameter
and avoid a number of identical multiplications

Dim radius As Single = 25
Dim diameter As Single = ( radius * 2 )

gp.AddLine(radius, 0, Width - diameter, 0)
gp.AddArc(Width - diameter, 0, diameter, diameter, 270, 90)

etc.


这篇关于Hefried在圆角上的帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆