Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

API: Rotate Text

Author(s)
Stephen Lebans

    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.

Download Acc Rotext WMF

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:

  1. Add a Custom Menu Item to the standard Toolbox or to the Standar Menu Bar.
  2. Right Click with your mouse on a blank area of the Toolbox or the Menu bar.
  3. From the dropdown menu select "Customize". A dialog window named "Customize" pops open with 3 tabs. 
  4. Select the second tab named "Commands". 
  5. 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.
  6. 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. 
  7. The "Modify Selection" button is now available. Click on it.
  8. Change the "NAME" property to ROTATE or whatever you want.
  9.  Now select "Properties".
  10. 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:

  1. Create a Label Control to your specifications. Dont forget to  fill in the "Tag" property with the number of degrees of rotation required. 
  2. Click on your Custom Menu Item or Toolbox Item to run this function. 
  3. 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


© 1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer