Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
MakeGradient()
End Sub
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
MakeGradient()
End Sub
Private Sub MakeGradient()
Dim objBrush As New Drawing2D.LinearGradientBrush(Me.DisplayRectangle, Color.Blue, Color.AliceBlue, Drawing2D.LinearGradientMode.Vertical)
Dim objGraphics As Graphics = Me.CreateGraphics()
objGraphics.FillRectangle(objBrush, Me.DisplayRectangle)
objBrush.Dispose()
objGraphics.Dispose()
End Sub
ابتدا متغیر های زیر را بصورت عمومی یعنی خارج از سابروتینها تعریف کنید
Private _closeClick AsBoolean
PublicConst SC_CLOSE AsInteger = 61536
PublicConst WM_SYSCOMMAND AsInteger = 274
سپس سابروتین زیر را بنویسید
Protected Overloads Overrides Sub WndProc(ByRef m As message)
If m.Msg = WM_SYSCOMMAND AndAlso m.WParam.ToInt32 = SC_CLOSE Then
ExitSub
Else
Me._closeClick = True
EndIf
MyBase.WndProc(m)
EndSub
در رویداد textchanged یک جعبه متن کد زیر را بنویسید
Private
Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If IsNumeric(Me.TextBox1.Text) = False Then Me.TextBox1.Text = "" End If End Sub