Option Explicit OnOption Strict On Public Class frmMain Dim StringSize As New SizeFDim StringSizeForLargerFont As New SizeFDim StringSizeForLargestFont As New SizeF Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load lblMessage.Text = "1 2 3 4 5 6 7 8 9 0 A 1 2 3 4 5 6 7 8 9 0 B 1 2 3 4 5 6 7 8 9 0 C " & _"1 2 3 4 5 6 7 8 9 0 D 1 2 3 4 5 6 7 8 9 0 E 1 2 3 4 5 6 7 8 9 0 F 1 2 3 4 5 6 7 8 9 0 G " & _"1 2 3 4 5 6 7 8 9 0 H 1 2 3 4 5 6 7 8 9"lblMessage.Width = 1280lblMessage.Font = New System.Drawing.Font("Trebuchet MS", 12)lblMessage.Font = New System.Drawing.Font(lblMessage.Font, FontStyle.Regular) lblMessageInLargerFont.Text = "1 2 3 4 5 6 7 8 9 0 A 1 2 3 4 5 6 7 8 9 0 B 1 2 3 4 5 6 7 8 9 0 C " & _"1 2 3 4 5 6 7 8 9 0 D 1 2 3 4 5 6 7 8 9 0 E 1 2 3 4 5 6 7 8 9 0 F"lblMessageInLargerFont.Width = 1280lblMessageInLargerFont.Font = New System.Drawing.Font("Trebuchet MS", 17.25)lblMessageInLargerFont.Font = New System.Drawing.Font(lblMessageInLargerFont.Font, FontStyle.Regular) lblMessageInLargestFont.Text = "1 2 3 4 5 6 7 8 9 0 A 1 2 3 4 5 6 7 8 9 0 B 1 2 3 4 5 6 7 8 9 0 C " & _"1 2 3 4 5 6 7 8 9 0 D 1 2 3 4 5 6 7 8 9 0 E 1 2"lblMessageInLargestFont.Width = 1280lblMessageInLargestFont.Font = New System.Drawing.Font("Trebuchet MS", 20.25)lblMessageInLargestFont.Font = New System.Drawing.Font(lblMessageInLargestFont.Font, FontStyle.Regular) End Sub Private Sub frmMain_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint e.Graphics.PageUnit = GraphicsUnit.Pixel StringSize = e.Graphics.MeasureString(lblMessage.Text, lblMessage.Font)StringSizeForLargerFont = e.Graphics.MeasureString(lblMessageInLargerFont.Text, lblMessageInLargerFont.Font)StringSizeForLargestFont = e.Graphics.MeasureString(lblMessageInLargestFont.Text, lblMessageInLargestFont.Font) lblInformation.Text = _"Screen Dimensions: " & GetScreenWidth() & " X " & GetScreenHeight() & vbCrLf & _"lblMessage Width: " & lblMessage.Width & vbCrLf & _"Message String Width: " & StringSize.ToString & vbCrLf & _"Larger Message String Width: " & StringSizeForLargerFont.ToString & vbCrLf & _"Largest Message String Width: " & StringSizeForLargestFont.ToString End Sub Public Function GetScreenHeight() As Integer Dim intY As Integer = Screen.PrimaryScreen.Bounds.Height Return intY End Function Public Function GetScreenWidth() As Integer Dim intX As Integer = Screen.PrimaryScreen.Bounds.Width Return intX End Function End Class