Print Page | Close Window


Printed From: Roger's Access Library
Category: Other Download Libraries
Forum Name: Tejpal, A.D.
Forum Description: A.D. Tejpal's Library
Printed Date: 20 Mar 2018 at 4:24pm

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 

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/


Email: -

Print Page | Close Window