Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

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.

 

 

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