The sun is still above the horizon. At 7:43 from Baden, Austria, I try to mention my Titel question with an additional example. Following the Window10 environment build 19041.985 Visual Studio Community Version 4.8.04084, the predefined Keys of a Logitech Deluxe 250 Keyboard are not altered with the visual basic method
Sub Kein_Stress_beim_Essen(e As KeyEventArgs)
Select Case e.KeyCode
Case Keys.Space
Dim Kautchuj As Drawing.Graphics = Me.CreateGraphics
Kautchuj.DrawRectangle(New Pen(Color.PaleGreen, 2), 250, 150, 100, 50)
End Select
End Sub
. To strengthen the sum for physical exercises, pull the shoulder bladebones to the rising sun balance until pushing back without regret where I need them. The DrawRectangle is set with the form property CreateGraphics. I search for and use the GDI+ objects that can be set to link a Me.KeyUp delegate with the event literature for more than one property. For my argument, I use an additional cross to start and end an even, odd-number discussion.
I try to screen a rectangle using the case keys. Space. While CreateGraphics is literally used to aim controls in Visual Basic with a rectangle object, I can imagine a paint event and do not know if the key event can also be used for an object.
I have a search pattern to concatenate operators in a not-named function. It is not possible that everything is an object, even with some energy exercises. To aim, I fade the predefined colour names to build an enum naming convention. Some dictionary brainstorm words are delegate, event args, tuple, keys, select, property, method and instance.
I do not consider the possibility of making new fonts because an IME substitution is not additional information for me.
It seems like you're asking how to draw boxes on the KeyUp
event. In that case, here's a quick demo of how it should be done:
Private ReadOnly points As New List(Of Point)
Private ReadOnly rng As New Random
Private Const BOX_DIMENSION As Integer = 10
Private Sub Form1_KeyUp(sender As Object, e As KeyEventArgs) Handles MyBase.KeyUp
Select Case e.KeyCode
Case Keys.Space
'Draw a new box at a random location.
Dim x = rng.Next(ClientSize.Width)
Dim y = rng.Next(ClientSize.Height)
points.Add(New Point(x, y))
'Repaint just the area that will be occupied by the new box.
Invalidate(New Rectangle(x, y, BOX_DIMENSION + 1, BOX_DIMENSION + 1))
Case Keys.Escape
'Erase all boxes.
points.Clear()
'Repaint the whole form.
Invalidate()
End Select
End Sub
Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
'Draw a box at each location.
For Each point In points
e.Graphics.DrawRectangle(Pens.Red, point.X, point.Y, BOX_DIMENSION, BOX_DIMENSION)
Next
End Sub
As you can see, all the drawing is done in the Paint
event handler. The KeyUp
event handler updates the data that represents the drawing and then forces a repaint.