Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Rotate Label in Visual Basic 6

Posted on 2009-05-13
3
Medium Priority
?
615 Views
Last Modified: 2012-05-06
I would like to rotate a text box in visual basic 6. It seems there is no method by default with the Label control to rotate it, is there anything else I can do to achieve rotated text printed on a form?
0
Comment
Question by:Terry Rogers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 46

Accepted Solution

by:
tbsgadi earned 1100 total points
ID: 24374524
0
 
LVL 1

Author Comment

by:Terry Rogers
ID: 24374581
That is only of limited help. I dont see how to change the font, the font size, the font colour or where the text is written on the form.
0
 
LVL 16

Assisted Solution

by:HooKooDooKu
HooKooDooKu earned 300 total points
ID: 24374899
There is no way to rotate a label.  Period.
That leaves you with two choises:
1. Buy a third party ocx that includes rotatable labels.
2. Use API function calls to draw the text yourself.

The code that tbsgadi pointed you to shows you the second option.  It gives you all the power in the "Windows" world to change font name, font style, font size.  This is because the code is using API functions to print text directly.  You can even change the font color, but that requires additional API functions not shown to manipulate properties of the Me.hdc.

But in any case, unless you want to pursue the 1st option, that means all these "properties" (size, style, color) is going to have to be something you deal with yourself (i.e. hard code in the logic or create a class, control, or UDT to store and work with these properties).

In this particular case, the font size was placed in a const pWIDTH and pHEIGHT (note, the values in the example are poor values as height is usually closer to twice the size of the width for a typical font, and you can also use a "default" width by setting with to zero).  The font type was hard coded in the CreateFont() function call to "Arial", the font rotation was passed as a parameter to the RotateText() Sub, and the position was set by setting the Form's CurrentX, CurrentY properties and getting the text printed using the "Print" method.  Now some of that could have been done differently using other API functions (such as TextOut() where you speicfy the X,Y position) but that's getting into even more API functions.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question