Question Diagonal text - correct code?

Mateus

Active member
Joined
Apr 16, 2010
Messages
27
Programming Experience
3-5
Hi all,
I'm a newbie to VB graphics and I'm wanting to have text appear diagonally across part of my app, like a stamp, saying "Printed".
Below is the code I'm using but I'm not sure if this is the best way to do it. Any tips would be greatly appreciated. Many thanks!

Public Class Form1
Dim bPrinted As Boolean = False​
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bPrinted = True
Me.Refresh()​
End Sub

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
If bPrinted = True Then
e.Graphics.RotateTransform(-36)
e.Graphics.DrawString("Printed", Font, Brushes.Red, 0, 50, StringFormat.GenericTypographic)​
End If​
End Sub
End Class
 
Back
Top