Advertisement
ledlight

Form1.vb

Feb 5th, 2024
1,802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.03 KB | Source Code | 0 0
  1. Imports System.Security.Cryptography
  2. Imports System.Text
  3.  
  4. Public Class Form1
  5.  
  6.     Dim TextBox_User As New TextBox
  7.     Dim TextBox_Password As New TextBox
  8.     WithEvents FrequenzBereich As New MyNewTextBox(TextBox_User, TextBox_Password)
  9.     Public WithEvents KrabkenStein As New MyButton
  10.     Public NumSticks As String
  11.     Public KannIch_BuBiEinZahl As String ' = Nothing
  12.     Public Sub New()
  13.         'MessageBox.Show(InputBox($"{KannIch_BuBiEinZahl}"))
  14.  
  15.  
  16.         NumSticks = InputBox($"{KannIch_BuBiEinZahl}") '"Armagedon" 'KannIch_BuBiEinZahl '.Text.ToString
  17.         ' Dieser Aufruf ist für den Designer erforderlich.
  18.         InitializeComponent()
  19.         SetUserToDefault(TextBox_User)
  20.         SetPasswordToDefault(TextBox_Password)
  21.         KrabkenStein.KonfettiKonfekt(KrabkenStein)
  22.         ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
  23.         Me.Controls.AddRange({TextBox_User, TextBox_Password, KrabkenStein})
  24.     End Sub
  25.     Public Sub SetUserToDefault(TextBox_User As TextBox)
  26.         With TextBox_User
  27.             .Location = New Point(100, 100)
  28.             .ForeColor = Color.Gray
  29.             .Font = New Font("Arial", 10, FontStyle.Italic)
  30.             .Text = "User Name"
  31.             .TabStop = False
  32.         End With
  33.     End Sub
  34.     Public Sub SetPasswordToDefault(TextBox_Password As TextBox)
  35.         With TextBox_Password
  36.             .Location = New Point(200, 200)
  37.             .ForeColor = Color.Gray
  38.             .Font = New Font("Arial", 10, FontStyle.Italic)
  39.             .Text = "Password"
  40.             .TabStop = False
  41.         End With
  42.     End Sub
  43.     Private Sub FrequenzBereich_Enter(sender As Object, e As EventArgs) Handles FrequenzBereich.Enter
  44.  
  45.         Dim tb As TextBox = DirectCast(sender, TextBox)
  46.         With tb
  47.             .ForeColor = Color.Black
  48.             .Font = New Font("Microsoft Sans Serif", 8, FontStyle.Regular)
  49.  
  50.             Select Case tb.Name
  51.                 Case "TextBox_User"
  52.                     If .Text = "User Name" Then
  53.                         .Clear()
  54.                     End If
  55.  
  56.                 Case "TextBox_Password"
  57.                     If .Text = "Password" Then
  58.                         .Clear()
  59.                     End If
  60.             End Select
  61.         End With
  62.     End Sub
  63.  
  64.     Private Sub FrequenzBereich_Leave(sender As Object, e As EventArgs) Handles FrequenzBereich.Leave
  65.  
  66.         Dim tb As TextBox = DirectCast(sender, TextBox)
  67.         If tb.Text.Trim = "" Then
  68.             Select Case tb.Name
  69.                 Case "TextBox_User"
  70.                     SetUserToDefault(FrequenzBereich)
  71.  
  72.                 Case "TextBox_Password"
  73.                     SetPasswordToDefault(FrequenzBereich)
  74.             End Select
  75.         End If
  76.     End Sub
  77.  
  78.     Private Sub Form1_KeyUp(sender As Object, e As KeyEventArgs) Handles Me.KeyUp
  79.  
  80.         Kein_Stress_beim_Essen(e)
  81.  
  82.     End Sub
  83.     Public ix, slitter As Integer
  84.     Public dest(5) As Char
  85.  
  86.  
  87.     Public number As Integer = 0
  88.     Sub Kein_Stress_beim_Essen(e As KeyEventArgs)
  89.  
  90.         Dim whilecatchOutsideoperators As New StringBuilder(NumSticks, 11) '
  91.  
  92.         For ix = 0 To slitter
  93.             If slitter < 7 Then
  94.                 whilecatchOutsideoperators.CopyTo(ix * 1, dest, 1, 1)
  95.             End If
  96.         Next ix
  97.         Select Case e.KeyCode
  98.             Case Keys.Space
  99.                 slitter += 1
  100.                 Number += 1
  101.                 Me.Invalidate()
  102.         End Select
  103.  
  104.     End Sub
  105.  
  106.     Private Sub Form1_Click(sender As Object, e As EventArgs) Handles Me.Click
  107.         Me.ActiveControl = Nothing
  108.         Form1_Enter(sender, e)
  109.     End Sub
  110.  
  111.     Private Sub Form1_Enter(sender As Object, e As EventArgs) Handles Me.Enter
  112.         Me.BackColor = Color.GreenYellow
  113.     End Sub
  114.  
  115.     Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
  116.         With e.Graphics
  117.             .DrawString(dest, New Font("Consolas", 22),
  118.             New SolidBrush(Color.FromArgb(151, 201, 104, 221)), New Point(500, 100))
  119.         End With
  120.     End Sub
  121. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement