FIX: Painting Problems When FontItalic Set True for Text Box (94293)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 2.0
This article was previously published under Q94293 SYMPTOMS
When you use a text box for input in a program, you will encounter painting
problems when the FontItalic property is set to True.
CAUSE
This problem is because of spacing. Italic fonts take up more room for each
character entered, but the text box does not account for this. The problem
occurs only when you type text into the text box. If you assign text to the
Text property at run-time, the problem does not occur.
WORKAROUND
To work around the problem, use the Refresh method to refresh the text box
each time a character is pressed. For best results, you should enable a
timer from within the KeyPress event for the text box. From within the
timer event, you can then use the Refresh method to refresh the contents
of the text box.
For example, you can work around the problem by adding the following steps
to those listed in the "More Information" section:
- Add a timer (Timer1) to Form1.
- Add the following code to the Text1_KeyPress event:
Sub Text1_KeyPress (KeyAscii As Integer)
Timer1.Interval = 1
Timer1.Enabled = True
End Sub
- Add the following code to the Timer1_Timer event for Timer1.
Sub Timer1_Timer ()
Text1.Refresh
'Disable the timer since you do not want the timer event
'to be continually executed
Timer1.Enabled = False
End Sub
- From the Run menu, choose Start (ALT, R, S).
- Enter some text in the Text1 text box. The characters should now
paint correctly.
STATUS
Microsoft has confirmed this to be a bug in Microsoft Visual Basic
version 2.0 for Windows. This problem was corrected in Microsoft Visual
Basic version 3.0 for Windows.
Modification Type: | Minor | Last Reviewed: | 1/9/2003 |
---|
Keywords: | kbbug KB94293 |
---|
|