How to change the font size of TextArea by CTRL+Mouse wheel?


Is there any way to make the font size of TextArea with CTRL+Mouse wheel action?
I want to give user a feature to control the size of it.
Please let me know if there is an example about it.

Set the text size to 10 and add an event handler:

Function KeyDown(Key As String) As Boolean

if key.asc = 29 then
me.TextSize = me.TextSize + 1
end if
End Function


I just put the below code in KeyDown event of Textarea. It works well.

if key.asc = 29 then me.TextSize = me.TextSize + 1 end if

Thanks a lot.

Horst Jehle.

Is it possible for me to use this function for Listbox?

This can be used with any control that has a TextSize.
Another example:

• add a ListBox to a Window
• add a Slider to a Window
• set Slider Minimum = 10 and value = 10
• add an event “ValueChanged” to Slider

Sub ValueChanged()
Listbox1.TextSize = me.Value
End Sub

• run project in Debug mode
• if you change the Slider position, the TextSize in ListBox1 get its value (TextSize) from the Slider value

This works only good, if you set the DefaultRowHeigth to -1

Just pressing CTRL shouldn’t cause the keydown event to be raised at all

Ctrl+scroll on OS X usually zooms everything

I’d use the mousewheel event instead

I followed the Slider way, really works well on Listbox.

Thank you!