Drawing Text on a Windows Form using ResizeRedraw Property.

Chikul
Posted by Chikul under Windows Forms category on | Views : 2373
Drawing Text on a Windows Form using ResizeRedraw Property.
Drawing Text on a Windows Form Using the Drawing Method of the Graphics Class and ResizeRedraw Property.
ResizeRedraw : It true if the control redraws itself when resized; otherwise, false.
The form constantly modifies the text as it is resized.

Public Class frmResizeRedraw

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

'Constructor of the Form
Public Sub New()

' This call is required by the Windows Form Designer.
InitializeComponent()

' Add any initialization after the InitializeComponent() call.

'Paint When Resized
Me.ResizeRedraw = True

End Sub
End Class

Comments or Responses

Login to post response