ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vertically centering text in a label field (https://www.excelbanter.com/excel-programming/444520-re-vertically-centering-text-label-field.html)

mondrogan

Vertically centering text in a label field
 
Because setting the textbox .enabled property = false results in a different "look" than the default appearance of a sunken label field. Prefer the look of the sunken label field. If you tell me there is nothing I can do to vertically center the font, then maybe I will be forced to use a textbox after all. But I'm hoping there is something I can do to use label field.


GS[_2_]

Vertically centering text in a label field
 
on 5/1/2011, mondrogan supposed :
Because setting the textbox .enabled property = false results in a different
"look" than the default appearance of a sunken label field. Prefer the look
of the sunken label field. If you tell me there is nothing I can do to
vertically center the font, then maybe I will be forced to use a textbox
after all. But I'm hoping there is something I can do to use label field.


Why can't you change the 'look' of the textbox so it resembles a sunken
label?

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc



GS[_2_]

Vertically centering text in a label field
 
GS explained on 5/1/2011 :
on 5/1/2011, mondrogan supposed :
Because setting the textbox .enabled property = false results in a
different "look" than the default appearance of a sunken label field.
Prefer the look of the sunken label field. If you tell me there is nothing
I can do to vertically center the font, then maybe I will be forced to use
a textbox after all. But I'm hoping there is something I can do to use
label field.


Why can't you change the 'look' of the textbox so it resembles a sunken
label?


To change a textbox so it 'looks' like a sunken label:

1. Change BackColor to SystemButtonFace.
2. Leave Enabled so the text doesn't display greyed out.
3. In its KeyDown event enter:
KeyCode = 0
This will prevent changes via the keyboard.
This will allow changes via code.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




All times are GMT +1. The time now is 08:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com