Drawing Text on a Windows Form using Invalidate Method.

Chikul
Posted by Chikul under Windows Forms category on | Views : 2052
Drawing Text on a Windows Form using Invalidate Method.
Drawing Text on a Windows Form Using the Drawing Method of the Graphics Class and Invalidate Method.
Invalidate : It Invalidates the entire surface of the control and causes the control to be redrawn.
The form constantly modifies the text as it is resized.


Public Class frmDrawText_Invalidate

Private Sub frmDrawText_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
'Create the Object of Graphics Class
Dim grpx As Graphics = e.Graphics
Dim strText As String = String.Format("My Form Size is : Width = {0} , Height = {1}", Width, Height)
grpx.DrawString(strText, Font, Brushes.Black, 0, 0)
End Sub

Private Sub frmDrawText_Invalid_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
Invalidate()
End Sub

End Class

Comments or Responses

Login to post response