vb.net怎样改变picturebox控件的形状
vb.net怎样改变picturebox控件的形状picturebox控件原来的形状是矩形的,我现在想把它改成圆形的,不知道怎么办,求大神指教...
vb.net怎样改变picturebox控件的形状picturebox控件原来的形状是矩形的,我现在想把它改成圆形的,不知道怎么办,求大神指教
展开
1个回答
展开全部
'我给你找到了,设置region属性就可
Private Sub PictureBox1_DoubleClick(sender As System.Object, e As System.EventArgs) Handles PictureBox1.DoubleClick
If PictureBox1.Region Is Nothing Then
Dim path As New System.Drawing.Drawing2D.GraphicsPath
path.AddEllipse(0, 0, 200, 200)
PictureBox1.Region = New Region(path)
Else
PictureBox1.Region = Nothing
End If
End Sub
'这个双击图片框使其变形,通过GraphicsPath对象可以作出各种形态来,比如可作出文字形状
Dim stringText As String = "我是谁"
Dim family As New FontFamily("Arial")
Dim myfontStyle As Integer = CInt(FontStyle.Italic)
Dim emSize As Integer = 86
Dim origin As New Point(20, 20)
Dim format As StringFormat = StringFormat.GenericDefault
path.AddString(stringText, family, myfontStyle, emSize, _
origin, format)
PictureBox1.Region = New Region(path)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询