Forms_CenterLabelsVertically.mdb |
Post Reply |
Author | |
A.D. Tejpal
Microsoft MVP Joined: 30 Jun 2008 Status: Offline Points: 192 |
Post Options
Thanks(0)
Posted: 08 Jul 2008 at 10:57pm |
This sample db demonstrates vertical centering of a label's caption text on a form. Need for such a feature typically arises when colored labels are sought to be used as command buttons. While horizontal centering can easily be implemented by setting the Text Align property to "Center", vertical centering needs precise setting of top and bottom margins (default value of both these margins is zero). Manually setting the two margins (top & bottom) equal to each other is not in itself adequate. These two values added to the text height should match the label height exactly. Otherwise, the caption might look truncated (if the sum of two margins plus text height exceeds label height) or off-center, towards top (if the sum is less than label height). The sample makes use of a sub routine that accepts two arguments (a) Name of the form containing target labels. (b) Tag value identifying labels on which vertical centering is to be implemented. The solution covers label captions spanning single as well as multiple rows. Note - This solution should be applied AFTER the font size and weight (for the labels) have been finally set.
|
|
Sponsored Links | Want a good read? Try The Summer of His Life (available on Amazon!) |
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |