Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Aug 13, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

React to Font-Changed Events

Use WithEvents to perform an action when you change any font properties of a specific control or form. Make sure you set the OLE Automation reference in the References dialog:

' Declaration section
Private WithEvents fntAny As StdFont

Private Sub fntAny_FontChanged(ByVal _
	PropertyName As String)
	Select Case PropertyName
		Case "Name"
			' Perform specific action
		Case "Size"
			' Perform specific action
		Case "Italic"
			' Perform specific action
		Case "Bold"
			' Perform specific action
		Case "Underline"
			' Perform specific action
		' Similarly, you can extend the
		' functionality for each font property.
	End Select
End Sub

You only have to assign any form or control's Font reference to fntAny. For example, if you want to trap the changes in the form's font attributes, add this code to the Form_Load event:

Set fntAny = Me.Font
' If a control, then Control.Font

Badari Syam
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date