Print Page | Close Window

Forms_CenterLabelsVertically.mdb

Printed From: Roger's Access Library
Category: Other Download Libraries
Forum Name: Tejpal, A.D.
Forum Description: A.D. Tejpal's Library
URL: www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=94
Printed Date: 20 Oct 2017 at 12:02pm


Topic: Forms_CenterLabelsVertically.mdb
Posted By: A.D. Tejpal
Subject: Forms_CenterLabelsVertically.mdb
Date 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: http://www.rogersaccesslibrary.com/forum/uploads/37/Forms_CenterLabelsVertically.zip - uploads/37/Forms_CenterLabelsVertically.zip



-------------
--

Email: mailto:adtejpal@gmail.com - adtejpal@gmail.com



Print Page | Close Window