logo
vbRad Home
Source Code
Book Reviews
Forum
Links
About Us
Contribute

Compare Databases with SQL Effects Clarity
 
 Vertical Text with Alignment Options

Posted on
12/26/2002
Author:
Robert Gelb
Email:
Not Shown
Applies To OS:
NT, 9x, 2000
Product:
5, 6



Download... the project. (3 kb)

There is an API to do rotated text, but not vertical text. Luckily it is easy enough to do just by using the venerable Print method, which has managed to live on since the GWBASICA days. In addition, this example provides alignment options, which allows you to print vertical text aligned to the left, center and right. Screenshot below shows how the output works for each of the alignments.

As with anything on vbRad.com, the class works out of the box. You download it, pop it in to your project, set properties and it just works. Here is how easy this is: you set the canvas to print on (PictureBox or a Form), x and y positions (left and top, respectively), set the alignment and then just Print. If your form AutoRedraw property is set to False and you want your text to survive a window repaint, place the code into the Form_Paint event.

Private Sub btnPrint_Click()
    Dim oVerticalText As cVerticalText
    
    Me.Picture1.Cls
    
    Set oVerticalText = New cVerticalText
    With oVerticalText
        Set .Canvas = Me.Picture1
        .x = 1500
        .y = 500
        .Alignment = Align_Center
        .PrintText "Whacky"
    End With
    
    Set oVerticalText = Nothing
End Sub

The download contains the class as well as a demo project. To use the class, simply drop it into your project.
Download... the project. (3 kb).





Add Your Comment  

Name: Email Address: all fields optional
Notify me via email when someone responds to this message (valid email required).

Enter the word: