Private za() As Integer
Private SP1() As Integer
Private SP2() As Integer
Private SP3() As Integer
Private Anzeige As String
Private Schritt As Integer
Private posX, posY As Integer
Private MausInSpalte As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
Dim x As Integer
Dim z, y As Integer
Dim neu As Boolean
ReDim za(21)
ReDim SP1(7)
ReDim SP2(7)
ReDim SP3(7)
For x = 1 To 21
Do
neu = True
z = Int(Rnd(1) * 99) + 1
For y = 1 To 21
If z = za(y) Then
neu = False
Exit For
End If
Next
Loop Until neu = True
za(x) = z
Next
austeilen()
Schritt = 0
Anzeige = "Merke dir eine Zahl. Klicke auf die Spalte, in der sich die" & _
"Zahl befindet!"
Me.MaximizeBox = False
Me.MinimizeBox = False
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim x As Integer
Dim p As New Pen(Color.DarkGreen, 3)
Dim PR As New Pen(Color.Red, 3)
Dim PT As New Pen(Color.Violet, 3)
Dim fo As New System.Drawing.Font("Arial", 20, FontStyle.Bold)
Dim fo1 As New System.Drawing.Font("Arial", 16, FontStyle.Bold)
Dim offx As Integer
Dim Zeile As Integer
Dim w() As String
w = Anzeige.Split(" ")
Dim teW As Integer
With e.Graphics
.DrawRectangle(PT, 5, 5, 470, 130)
PT.Width = 2
.DrawRectangle(PT, 9, 9, 463, 123)
PT.Width = 1
.DrawRectangle(PT, 11, 11, 458, 118)
For x = 0 To w.Length - 1
If teW > 400 Then
teW = 0
Zeile += .MeasureString("Tg", fo1).Height
End If
.DrawString(w(x), fo1, Brushes.DarkViolet, 13 + teW, 13 + Zeile)
teW += .MeasureString(w(x), fo1).Width
Next
For x = 0 To 2
If posX > (5 + 160 * x) And (posX < 155 + 160 * x) _
And posY > 150 And posY < 480 Then
.DrawRectangle(p, 5 + 160 * x, 150, 150, 330)
Else
.DrawRectangle(PR, 5 + 160 * x, 150, 150, 330)
End If
Next
Zeile = .MeasureString("0", fo).Height
For x = 1 To 7
offx = .MeasureString(SP1(x), fo).Width / 2
.DrawString(SP1(x), fo, Brushes.Red, 80 - offx, 160 + (x * _
Zeile))
offx = .MeasureString(SP2(x), fo).Width / 2
.DrawString(SP2(x), fo, Brushes.Red, 240 - offx, 160 + (x * _
Zeile))
offx = .MeasureString(SP3(x), fo).Width / 2
.DrawString(SP3(x), fo, Brushes.Red, 400 - offx, 160 + (x * _
Zeile))
Next
End With
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Dim x As Integer
Dim InSpalte As Boolean
posX = e.X
posY = e.Y
For x = 0 To 2
If posX > (5 + 160 * x) And (posX < 155 + 160 * x) _
And posY > 150 And posY < 480 Then
InSpalte = True
If MausInSpalte <> x + 1 Then
MausInSpalte = x + 1
Me.Refresh()
End If
End If
Next
If InSpalte = False And MausInSpalte <> -1 Then
MausInSpalte = -1
Me.Refresh()
End If
End Sub |