At 9:23 PM +0200 3/30/05, Donn Edwards wrote:
Is there any way I can adjust the TextSize of the controls on a window
programatically at runtime?
Sure, just assign a new value.
In VBA one could say
Dim sngZoom as single, ctl as control
for each ctl in form.controls
ctl.fontSize = ctl.FontSize * sngZoom
next ctl
How does one do this in RB?
Pretty much the same way, except that "for each" won't work as
Window.Control is not an array, but a function. Also, not all
controls have a TextSize property; only certain ones do. So you'd do
something like this:
for i = 0 to form.ControlCount - 1
ctl = form.Control(i)
if ctl IsA StaticText then
StaticText(ctl).TextSize = StaticText(ctl).TextSize * sngZoom
elseif ctl IsA PushButton then
PushButton(ctl).TextSize = PushButton(ctl).TextSize * sngZoom
end if
next
Unfortunately you have to add each class you want to support changing
the text size of, because there is no common interface for things
that have a font and style (perhaps there should be... hmm...).
Best,
- Joe
--
,------------------------------------------------------------------.
| Joseph J. Strout REAL Software, Inc. |
| joe at realsoftware dot com http://www.realsoftware.com |
`------------------------------------------------------------------'
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|