Roger's Access Library Homepage
Forum Home Forum Home > Other Download Libraries > MS Access MVP Libraries > Tejpal, A.D.
  New Posts New Posts RSS Feed - Forms_CenterLabelsVertically.mdb
  FAQ FAQ  Forum Search   Events   Register Register  Login Login


Please consider donating $1 per sample downloaded, (find out why here)

Forms_CenterLabelsVertically.mdb

 Post Reply Post Reply
Author
Message
A.D. Tejpal View Drop Down
Microsoft MVP
Microsoft MVP


Joined: 30 Jun 2008
Status: Offline
Points: 192
Post Options Post Options   Thanks (0) Thanks(0)   Quote A.D. Tejpal Quote  Post ReplyReply Direct Link To This Post Topic: Forms_CenterLabelsVertically.mdb
    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.

Download Access XP & 2K: uploads/37/Forms_CenterLabelsVertically.zip

--

Email: adtejpal@gmail.com
Back to Top
Sponsored Links


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down