I have the following Windows forms application using default names for objects.
1 form, and 1 button.
After pushing the button, what this does is place a small red rectangle in the top left corner of the form.Code:Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red) Dim formGraphics As System.Drawing.Graphics Dim myRect As Rectangle myRect = New Rectangle(0, 0, 10, 10) formGraphics = Me.CreateGraphics formGraphics.DrawRectangle(myPen, myRect) myPen.Dispose() formGraphics.Dispose() End Sub End Class
I would like to add a small text to the right of the rectangle, or under and to the left and etc. Is there a simple way to do this, or do I have to use several GDI+ functions together. I would like to use as much of the .NET classes as possible instead of re-creating code for this if possible. Any suggestions?
Also, as a further note. The idea is a map that has icons moving around it, indicating different kind of units. Cars, planes etc.




Reply With Quote