下列代码功能是改变当前窗体形状为椭圆形:
Dim P As System.Drawing.Drawing2D.GraphicsPath = New System.Drawing.Drawing2D.GraphicsPath ( )
P.AddEllipse ( 0 , 0 , Me.ClientSize.Width, Me.ClientSize.Height)
Me.Region = New Region ( P )
下列代码功能是改变当前窗体形状为扇形:
Dim P As System.Drawing.Drawing2D.GraphicsPath = New System.Drawing.Drawing2D.GraphicsPath ( )
P.AddPie ( 10 , 10 , 200 , 200 , 5 , 150 )
Me.Region = New Region ( P )
下列代码功能是改变当前窗体形状为环形:
Dim P As System.Drawing.Drawing2D.GraphicsPath = New System.Drawing.Drawing2D.GraphicsPath ( )
Dim Height As Integer = Me.ClientSize.Height
Dim width As Integer = 80
P.AddEllipse ( 0 , 0 , Height , Height )
P.AddEllipse ( width , width , Height - ( width * 2 ) , Height - ( width * 2 ) )
Me.Region = New Region ( P )
其实只要把Me.Region重定义个New Region(GraphicsPath)即可改变窗体形状,大家也可以试试改成别的形状的窗体!
Dim P As System.Drawing.Drawing2D.GraphicsPath = New System.Drawing.Drawing2D.GraphicsPath ( )
P.AddEllipse ( 0 , 0 , Me.ClientSize.Width, Me.ClientSize.Height)
Me.Region = New Region ( P )
下列代码功能是改变当前窗体形状为扇形:
Dim P As System.Drawing.Drawing2D.GraphicsPath = New System.Drawing.Drawing2D.GraphicsPath ( )
P.AddPie ( 10 , 10 , 200 , 200 , 5 , 150 )
Me.Region = New Region ( P )
下列代码功能是改变当前窗体形状为环形:
Dim P As System.Drawing.Drawing2D.GraphicsPath = New System.Drawing.Drawing2D.GraphicsPath ( )
Dim Height As Integer = Me.ClientSize.Height
Dim width As Integer = 80
P.AddEllipse ( 0 , 0 , Height , Height )
P.AddEllipse ( width , width , Height - ( width * 2 ) , Height - ( width * 2 ) )
Me.Region = New Region ( P )
其实只要把Me.Region重定义个New Region(GraphicsPath)即可改变窗体形状,大家也可以试试改成别的形状的窗体!