Access does not internally support rotated text.
However, by using API functions, we can rotate a Label Control by creating an Image Control containing
a bitmap of the rotated label. The sample code in the database only uses one
bitplane to conserve memory.
How to use:
In Report or Form Design View create a label control. Use the controls property sheet
to set the .Tag property for the number of degrees of rotation required. This must be a number from 0 - 360. All other
properties, such as font name and size are setup as usual.
Simply make the label look exactly the way you want it before it is rotated.
It is the controls Caption property that determines what is displayed on the control.
Rotated Labels in Form View support colored backgrounds, borders & special effects.
Rotated Labels in Report View only partially support backgrounds and borders.
In Report View the Image control contains a bitmap that is at a higher resolution
than the screen. Because of this the Rotated control must have its SizeMode property
set to Zoom. Therefore, unlike Form view, you cannot simply resize the Border without
resizing the actual image as well. A workaround is to create all of your Report
rotated labels with white as a background color and no border. Next simply
create a Label control with a transparent background and the border of your choosing.
Now overlay this transparent label on top of the Rotated label control.
How to call this function:
-
Add a Custom Menu Item to the standard Toolbox or to the Standar Menu Bar.
- Right Click with your mouse on a blank area of the Toolbox or the Menu bar.
- From the dropdown menu select "Customize". A dialog window named "Customize"
pops open with 3 tabs.
- Select the second tab named "Commands".
- This Window is divided into 2 subwindows. On the left is "Categories" on
the right side is "Commands" . Make sure the first item "File" on the left hand window
is selected. Now in the right hand window you should see the item "Custom".
Scroll the window up or down if it is not visible.
- Now with your left mouse button click - hold - drag and drop the "Custom" item
onto the Standard Toolbox or Standard Menu Bar. Release the mouse button.
- The "Modify Selection" button is now available. Click on it.
- Change the "NAME" property to ROTATE or whatever you want.
- Now select "Properties".
- In the "On Action" property fill it in exactly as below with the name of this function.
=fRotext()
Thats it. Click "Close" then "Close" again.
Now from Form Design View you can:
- Create a Label Control to your specifications. Dont forget to fill in the "Tag" property with the number of degrees of rotation required.
- Click on your Custom Menu Item or Toolbox Item to run this function.
- A new Image control is created containing the Rotated Text
To be used from Form or Report Design View only! Make sure the label you want this function
to work on is the currently selected control before you select the custom menu item
that calls this function.
CREATE a New Module in your Database and copy EVERYTHING exactly as it appears here
into your new module. Save your new module with a name that DOES NOT MATCH any of
the functions contained here!!!!!
Enjoy
Stephen Lebans
|