ASKER
Private Sub MeasureStringMin(ByVal e As PaintEventArgs)
' Set up string.
Dim measureString As String = "Measure String"
Dim stringFont As New Font("Arial", 16)
' Measure string.
Dim stringSize As New SizeF
stringSize = e.Graphics.MeasureString(measureString, stringFont)
' Draw rectangle representing size of string.
e.Graphics.DrawRectangle(New Pen(Color.Red, 1), 0.0F, 0.0F, _
stringSize.Width, stringSize.Height)
' Draw string to screen.
e.Graphics.DrawString(measureString, stringFont, Brushes.Black, _
New PointF(0, 0))
End Sub
ASKER
Private Sub ShowLoadStatusMessage(ByVal strMsg As String, ByVal blnShowStatus As Boolean, ByVal e As PaintEventArgs)
Try
'mlStatusMessage is the Label Control
Dim stringFont As New Font(mlStatusMessage.Font, Font.Bold)
Dim stringSize As New SizeF
EH.ErrorMessage = String.Empty
mlLoadStatus.Text = strMsg
mlLoadStatus.Left = (mlLoadStatus.Width - mlLoadStatus.Width) / 2
mlLoadStatus.Top = (mlLoadStatus.Height - mlLoadStatus.Height) / 2
mlLoadStatus.BringToFront()
If blnShowStatus Then
mlLoadStatus.Visible = True
Else
mlLoadStatus.Visible = False
End If
stringSize = e.Graphics.MeasureString(strMsg, stringFont)
' Draw rectangle representing size of string.
e.Graphics.DrawRectangle(New Pen(Color.Red, 1), 0.0F, 0.0F, stringSize.Width, stringSize.Height)
' Draw string to screen.
'e.Graphics.DrawString(strMsg, stringFont, Brushes.Black, New PointF(0, 0))
Catch ex As Exception
EH.ErrorMessage = "frmCalibration_3/ShowLoadStatusMessage() - " & ex.Message & "...Contact Engineering!" & "~E"
End Try
End Sub
Private Sub ShowLoadStatusMessage(ByVal strMsg As String, ByVal blnShowStatus As Boolean)
Try
'mlStatusMessage is the Label Control
Dim stringFont As New Font(mlStatusMessage.Font, Font.Bold)
Dim stringSize As New SizeF
EH.ErrorMessage = String.Empty
mlLoadStatus.Text = strMsg
mlLoadStatus.Left = (mlLoadStatus.Width - mlLoadStatus.Width) / 2
mlLoadStatus.Top = (mlLoadStatus.Height - mlLoadStatus.Height) / 2
mlLoadStatus.BringToFront()
If blnShowStatus Then
mlLoadStatus.Visible = True
Else
mlLoadStatus.Visible = False
End If
Dim G As Graphics = Me.CreateGraphics()
stringSize = G.MeasureString(strMsg, stringFont)
' ... now do something in here with "stringSize" and your label, "mlStatusMessage" ...
G.Dispose()
Catch ex As Exception
EH.ErrorMessage = "frmCalibration_3/ShowLoadStatusMessage() - " & ex.Message & "...Contact Engineering!" & "~E"
End Try
End Sub
ASKER
ASKER
Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,
TRUSTED BY