
vb题!有谁会帮帮忙啊!急急急
展开全部
Imports System.Drawing.drawing2d
Public Class 不规则窗体
Dim downpoint As Point = Point.Empty
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Close()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
s()
End Sub
Private Sub 不规则窗体_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
If e.Button <> Windows.Forms.MouseButtons.Left Then Exit Sub
downpoint = New Point(e.X, e.Y)
End Sub
Private Sub 不规则窗体_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If downpoint = Point.Empty Then Exit Sub
Dim location As Point = New Point(Me.Left + e.X - downpoint.X, Me.Top + e.Y - downpoint.Y)
Me.Location = location
End Sub
Private Sub 不规则窗体_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
downpoint = Point.Empty
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics
Dim mypen As New Pen(Color.Red, 5)
Dim rect As New Rectangle
g.DrawEllipse(mypen, 50, 50, 200, 200)
g.FillEllipse(Brushes.Brown, 50, 50, 200, 200)
End Sub
'画不规折窗体
Sub s()
Dim rect As Rectangle = Me.ClientRectangle
Dim path As GraphicsPath = New GraphicsPath
path.AddEllipse(rect)
Me.Region = New Region(path)
End Sub
End Class
这是画圆的 直接改下代码就可以了。。。。可以的话请采纳。。。
Public Class 不规则窗体
Dim downpoint As Point = Point.Empty
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Close()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
s()
End Sub
Private Sub 不规则窗体_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
If e.Button <> Windows.Forms.MouseButtons.Left Then Exit Sub
downpoint = New Point(e.X, e.Y)
End Sub
Private Sub 不规则窗体_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If downpoint = Point.Empty Then Exit Sub
Dim location As Point = New Point(Me.Left + e.X - downpoint.X, Me.Top + e.Y - downpoint.Y)
Me.Location = location
End Sub
Private Sub 不规则窗体_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
downpoint = Point.Empty
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics
Dim mypen As New Pen(Color.Red, 5)
Dim rect As New Rectangle
g.DrawEllipse(mypen, 50, 50, 200, 200)
g.FillEllipse(Brushes.Brown, 50, 50, 200, 200)
End Sub
'画不规折窗体
Sub s()
Dim rect As Rectangle = Me.ClientRectangle
Dim path As GraphicsPath = New GraphicsPath
path.AddEllipse(rect)
Me.Region = New Region(path)
End Sub
End Class
这是画圆的 直接改下代码就可以了。。。。可以的话请采纳。。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询