Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- ' Load up a graphic
- Dim cityimg As Bitmap = New Bitmap("c:\\ourcityimage.jpg")
- ' Create a graphics object to work on the image
- Dim imgGraphics As Graphics = Graphics.FromImage(cityimg)
- ' Create a white rectangle on our image that is x=8, y=8 30 in width and 15 in height
- imgGraphics.FillRectangle(Brushes.White, 8, 8, 30, 15)
- ' Create a 10 pt font in verdana and write test in black, putting its coordinates in our white rectangle
- Dim ourFont As New Font("Verdana", 10)
- imgGraphics.DrawString("test", ourFont, New SolidBrush(Color.Black), 10, 9)
- ' Get a handle for the form and draw right on the form
- Dim formGraphics As Graphics = Graphics.FromHwnd(Me.Handle)
- formGraphics.DrawImage(cityimg, 10, 10)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment