Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Rotate Text

Hi,I have to write an ActiveX Control (Visual Basic 6.0) in which i have to display a text. The Text should be rotated about 90 degree, you know, like in a Chart control the label for the y-axis.I do not know how to establish it, i only can use "Print ..." to display a text on the control.I hope, some of you have an idea how to do it, thanks

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
DX Rotate Help Needed With .lock On Surface (The DX Rotate Challenge =P)
Rotate in DX!!!!

Please can somebody have a look and try to find out why it is not blting once i rotate it??? It even doesnt work if i set angle to 0.

Rotate Text
How do I rotate text printed on a form? I mean each character should be rotated e.g. 90 deg. counterclockwise about itself.

Rotate Text
I can rotate text on a form object, or picture object. However, when I try to rotate text to send to a printer object it doesn't work. Is there a reason text doesn't rotate on the printer object?

Text Rotate And Mirror
hi is it possible to rotate text in a label or text box by 90 degrees and can you make text appear back to front.

Rotate Text In Caption
What I would like to do is have a button that says "Add" followed by ">>", but the ">>" needs to be rotated to both pointing down (one on top of the other). In other words, I need to take ">>" and rotate it to the right by 90 degrees. Is there a way to do this? Or, is there some other "text" I can use to do this? Thanks in advance!

Rotate Text In DBGrid

Is it somehow possible to rotate text in DBGrid cells, like you can do it excel cells?

How Do I Rotate A Text Box 90 Degrees In Vba
Hello Friends,

I am using VBA in excel 2000. How do I rotate a text box so that it is vertical and not horizontal.

So if I type in Visual it would show up as


as opposed to VISUAL



Rotate Text Without A Picture Box
I don't know ... but this code does. I found it at, perhaps it will help.

It rotates the text anywhere from 0 to 360 degrees.

Micah Carrick
Ordinary joe, only not named joe.
ICQ: 53480225

Rotate Text Without A Picture Box
I don't know ... but this code does. I found it at, perhaps it will help.

It rotates the text anywhere from 0 to 360 degrees.

Micah Carrick
Ordinary joe, only not named joe.
ICQ: 53480225

How To Rotate A Text Box In Access 97
Does anyone know if there is a way to rotate a text box in a Microsoft Access 97 report?  I need to make the text in some fields upside down while others remain rightside up. I have not been able to find a property or method that would allow me to do this.

Rotate Text/labels
I have an image with 4 labels above it. I want the labels to remain over the image. However, the length of the labels forces the 4th label to extend far beyond the right side of the image. One solution I had was to rotate the labels so that they will fit. Is there a way to do this in VB? Thanks.

Rotate Text In Datareport
Hi, i have a datareport and want to print some things rotated 90
something like this:
any idea how to do this? the text and numbers are loaded from a DB

Is It Possible To Rotate Text On User Form?
I once saw a bit of code that allowed one to put text on a Command Button rotated at 180 degrees. Does anyone know how to do that? Oh, I am using VB6 by the way.

Thanks in advance.

Rotate Captions Or Text Boxs?
I know its been asked before, but all the previous threads about it pointed to a link that doesn't exist anymore.

How To Rotate Text In Visual Basic?

iam using createA Api to rotate text and printt on an x,y location in picture box.iam giving an angle of 2650 to rotate a text called
y-axis as y
iam using an application called chart application which is used to plot curves.

plotting is done on picture box?

the problem is the text is not rotating towards any angle.

what will be the problem is there any solution without using API.

Crystal Reports 8: Rotate A Text Object 90 Degrees...
Hi all,

Is there a way to rotate text objects in CR version 8 by 90 degrees? Alternatively, is there a way to (easily) create vertical text objects?


Rotate MULTI LINE Text (question For Experts)
Ok, there a thousands of examples to rotate text and they work fine if you want to print a SINGLE line of text.
But I want to print MULTIPLE lines ("TTT" & vbCrLf & "TTT") and when I do so at for example a 90 angle the lines at printed on top of each other because all lines start at the same X-position (instead of x+TextHeight for line 2).

Sure, I could calculate the starting point of each line myself, but is there a function to rotate multi line text in a way that it is still like a square? I.e. the the vertical part of the T in line 1 alignes with the vertical part of the T in line 2.

Thanks, Jo

Rotate Text Only Work To Screen, But Dont Work For Printer
Im using the follow routine to print rotate text to screen and works fine. But using this routine to print on printer, dont work, and print always on 180 degree.

Any help?


VB Code:
Sub Print_angular(PB As Variant, ByVal Text As String, Optional ByVal Angle As Integer = -900, Optional x As Variant, Optional y As Variant)     Dim hfont As Long, holdfont As Long    Dim Font As LOGFONT    Const GM_ADVANCED = 2    Const LOGPIXELSY = 90         SetGraphicsMode PB.hDC, GM_ADVANCED                ' Create a Font object, similar to the current font in PB        ' but with a different orientation        PB.FontSize = 6        Font.lfHeight = -MulDiv(PB.FontSize, GetDeviceCaps(PB.hDC, LOGPIXELSY), 72)        Font.lfWidth = 0        Font.lfEscapement = Angle        Font.lfOrientation = Angle        Font.lfWeight = IIf(PB.FontBold, 700, 400)        Font.lfItalic = IIf(PB.FontItalic, 1, 0)        Font.lfUnderline = IIf(PB.FontUnderline, 1, 0)        Font.lfStrikeOut = IIf(PB.FontStrikethru, 1, 0)        Font.lfCharSet = 0        Font.lfOutPrecision = 0        Font.lfClipPrecision = 0        Font.lfQuality = 2        Font.lfPitchAndFamily = 33        Font.lfFaceName = PB.FontName & vbNullChar                hfont = CreateFontIndirect(Font)        holdfont = SelectObject(PB.hDC, hfont)                ' Account for X,Y coordinates        If Not IsMissing(x) Then PB.CurrentX = x        If Not IsMissing(y) Then PB.CurrentY = y                ' do the printing               PB.Print Text            ' reselect the old font    SelectObject PB.hDC, holdfont    ' destroy the font object just created    DeleteObject hfont  End Sub

WIA Rotate Example?!?!
Im trying to find how to use the Windows Image Acquisition and use the ROTATE instruction, but i can't make it work, is someone that have used this method before?!

Need To Rotate .GIF
HELP, im making a game that requires a .GIF file to rotate so that i dont have to draw 100 pictures I need to know the easiest way to do this.. Including DirectX (DirectX 7)

Rotate BLT?
Isn't there a blt that also roates a image, if specified?

D3D RM Rotate
i am learning with the directx7 rm mode. i want to knowif there is an easy way to rotate an object without setting it to constantly rotate as with the .setrotation method. -----Also i am used to programming tile based games whre you can blt tiles onto a screen and want to know if in RM d3d if i have to make a new object for every tile on the screen? if so how would i do this?


say i have a cannon or bat looking pic is there a way i can just have it rotate in a direction instead of drawing a picture for each stage of the rotation?

Why Won't It Rotate?
Why can't I get this image to rotate? The tip won't work, and no other WEB pages have anything useful.



Anyone knows how to rotate a picture box ?

I mean to say like a picture box is like:

| |

i want a picture box like:


like rotating the square picture box to some it possible ?


Why Won't It Rotate?
Why can't I get this image to rotate? The tip won't work, and no other WEB pages have anything useful.


Ive just bought an Olympus C-120 digital camera and I want to use it for archiving( a whole lot quicker than a scanner) . All Ok except that when you download your pics they are lanscape format (.jpg). I know you can open them up and manipulate orientation in lots of photo packages but can any one suggest a way to do this in bulk? when you have 500 images to convert, even a few mouse clicks can take a long time- and Ive got 20,000 to do in total. Regards BrianFaux

Rotate Pic Box
I was wondering if anyone knows of a way to rotate a pic box w/o using the BitBlt function? i could have sworn i saw how to do it once, and now that i need it, i cant find it.

Rotate A Screen

i have a tablet pc and now i want to use it set up on the edge, it has no function to rate the screen by 90 can u say me a function or api to rotate the screen`?

Freeimage Rotate
I am having trouble rotating an image using freeimage rotate functions. The functions appear to work, but the image does not get rotated. Here is the code I am using, perhaps someone more enlightened can see what I am doing wrong?

Dim bOK As Long
Dim DIB As Long
Dim Angle as Double


' load the file into the DIB
DIB= FreeImage_Load(FIF_JPEG, "Image.jpg", JPEG_DEFAULT)

If DIB <> 0 Then
' do the rotate
bOK = FreeImage_RotateClassic(DIB, Angle)
If bOK <> 0 Then
' save the rotated file
bOK = FreeImage_Save(FIF_JPEG, DIB, "Image.jpg",JPEG_DEFAULT)
End if
End if

Image.jpg should now be rotated, but it isn't!

I have also tried using 'FreeImage_RotateEx' , but with the same result.

Rotate A Point
How would you rotate a point around an origin? (e.g. rotate a line x number of degrees). Heres the code I have. It uses 3 controls:

Private Sub cmdRotate_Click()
Call Line_Rotate(txtRotate.Text)
End Sub

Private Sub Line_Rotate(Degrees As Integer)
Dim Radians As Single
Dim X1 As Integer
Dim Y1 As Integer
Dim Constant As Single

Constant = 57.2957795130823
Radians = Degrees / Constant

X1 = Line1.X2 + ((Line1.X1 - Line1.X2) + Cos(Radians)) _
+ ((Line1.Y1 - Line1.Y2) * Sin(Radians))

Y1 = Line1.Y2 + ((Line1.Y1 - Line1.Y2) + Cos(Radians)) _
- ((Line1.X1 - Line1.X2) * Sin(Radians))

Line1.X1 = X1
Line1.Y1 = Y1
End Sub


Rotate A Pic/img Before Load Vb6! Help!!
im looking the way to rotate an image or picture before load, someone can help me?!? i saw many applications, but they rotate the image after load, and they always use 2 pictures box, is there a way to rotate it before load into the picturebox or image???

Rotate 1 Bit Picture
dear all

I have found several code samples on this list (eg that will rotate 8 bit pictures.

I wish to rotate a 1 bit black and white grid preferably smoothly and with preferably less cpu usage than the 8 bit rotations use. Can anyone help me?



How To Rotate A Image In 90?
I needed to find some way to Rotate a picture in 90. So far I've done a routine that stores the pic in bmp format, then opens the bmp, stores the info in a matrix then rotates, and finaly stores, but I found it very time consuming...if anyone can help I would be very pleased


GDIP+ Rotate
I applogise if I'm being thick, but...

I'm trying to rotate an image using GDIP. Here's an extract from the code

GdipCreateFromHDC(Picture1.hDC, gfx)
GdipGetImageWidth img, iW
GdipGetImageHeight img, iH
GdipSetInterpolationMode(gfx, InterpolationModeHighQualityBicubic)
GdipTranslateWorldTransform(gfx, Picture1.ScaleHeight / 2, Picture1.ScaleWidth / 2, MatrixOrderAppend)
GdipRotateWorldTransform(gfx, angle, MatrixOrderPrepend)
GdipDrawImageRectRectI(gfx, img, 0, 0, Picture1.ScaleX(Picture1.Width, vbTwips, vbPixels), Picture1.ScaleY(Picture1.Height, vbTwips, vbPixels), 0, 0, iW, iH, UnitPixel, 0, 0, 0)
(A full blown test project is attached)

When I run without the three "WorldTransform" statements (in blue), I get the image displayed correctly. When I include these statements, I get nothing.

BTW - I need to use GdipDrawImageRectRectI because I need to resize the image in the "real" version.

Rotate A Image
heres my code, that i found in net but with some changes, to rotate a image:

Public Function RotateImage(pic1 As PictureBox, pic2 As PictureBox, ByVal PosX As Long, ByVal PosY As Long, ByVal theta!)
Const PI = 3.14159265359
Dim c1x As Integer ' Center of pic1.
Dim c1y As Integer ' "
Dim c2x As Integer ' Center of pic2.
Dim c2y As Integer ' "
Dim a As Single ' Angle of c2 to p2.
Dim r As Integer ' Radius from c2 to p2.
Dim p1x As Integer ' Position on pic1.
Dim p1y As Integer ' "
Dim p2x As Integer ' Position on pic2.
Dim p2y As Integer ' "
Dim n As Integer ' Max width or height of pic2.
If pic1.Height > pic1.Width Then
pic2.Width = pic1.Height
pic2.Height = pic1.Height
pic2.Width = pic1.Width
pic2.Height = pic1.Width
End If
' Compute the centers.
c1x = pic1.ScaleWidth / 2
c1y = pic1.ScaleHeight / 2
c2x = pic2.ScaleWidth / 2 + PosX
c2y = pic2.ScaleHeight / 2 + PosY

' Compute the image size.
n = pic2.ScaleWidth
If n < pic2.ScaleHeight Then n = pic2.ScaleHeight
n = n / 2 - 1
' For each pixel position on pic2.
For p2x = 0 To n
For p2y = 0 To n
' Compute polar coordinate of p2.
If p2x = 0 Then
a = PI / 2
a = Atn(p2y / p2x)
End If
r = Sqr(1& * p2x * p2x + 1& * p2y * p2y)

' Compute rotated position of p1.
p1x = r * Cos(a + theta)
p1y = r * Sin(a + theta)

'Copy pixels, 4 quadrants at once.
c0& = GetPixel(pic1.hDC, c1x + p1x, c1y + p1y)
c1& = GetPixel(pic1.hDC, c1x - p1x, c1y - p1y)
c2& = GetPixel(pic1.hDC, c1x + p1y, c1y - p1x)
c3& = GetPixel(pic1.hDC, c1x - p1y, c1y + p1x)
If c0& <> -1 Then SetPixel pic2.hDC, c2x + p2x, c2y + p2y, c0&
If c1& <> -1 Then SetPixel pic2.hDC, c2x - p2x, c2y - p2y, c1&
If c2& <> -1 Then SetPixel pic2.hDC, c2x + p2y, c2y - p2x, c2&
If c3& <> -1 Then SetPixel pic2.hDC, c2x - p2y, c2y + p2x, c3&
' Allow pending Windows messages to be processed.
t% = DoEvents()
End Function
this function is working, but i think that the coordenates point whith angle are round... can any one teste the code and tell me where is the error?
thank you

Rotate Transform
I'm getting confused in math.

Can sombody give some formules to calculate new positions after a transform in x,y,z, under different rotations.

Thanks a lot.

Image Rotate
hey does anybody know a quick way to rotate images? i already know that the best way is to draw the image for each angle, but i dont need that, i need to rotate the image for a game.

Rotate, Example Perfect
my problem is to rotate bitmap equal to the example found in net a someone to help me? thanks

How To Do A Simple Rotate In DX7?
I've read thru all the current messages about rotating an image in DX7, and they're all dealing w/ a much more complex than my problem.

I'm looking to rotate an image 90* CCW. That's it, nothing more at the moment. Any built in function to do this?


P.S. -- If it makes a difference, I'm just emulating Space Invaders, and I'm trying to rotate the 256x224 image right before I display it on screen. I really don't want to go and move each pixel by hand. Surely there's a function to do this very simple rotate.

P.P.S -- Maybe after it's rotated, then I'll mess w/ scaling and translation.

Need Help: Rotate A Picture? :o(
Hi! :o)

I'm programming a game in DirectDraw7.
A simple picture I draw like this (for example):


With Surface
SrcRECT.Top = Object.Animation.CurrentRow * .RowHeight
SrcRECT.Left = Object.Animation.CurrentCol * .ColWidth
SrcRECT.Right = SrcRECT.Left + .ColWidth
SrcRECT.Bottom = SrcRECT.Top + .RowHeight

DestRECT.Top = Object.Top + ScrollPosY
DestRECT.Left = Object.Left + ScrollPosX
DestRECT.Right = DestRECT.Left + .ColWidth
DestRECT.Bottom = DestRECT.Top + .RowHeight

End With

Everything is working well, except that there is a major problem: I don't know how I can rotate a picture (in any angle)?

For your understanding: In the game you drive a car and the view is from above (bird's eye view). So if you turn the car the picture has to rotate. First I thought I'll make one picture of each car in each angle. However, that'd be impossible as there are many different cars and I'd have to make 360 pictures of each car :o(

So I guess the only possible solution is to rotate the picture in DirectDraw. But I have no idea how I could realize that.

I hope anyboady can help me :o)
It'd be great if someboady had an example!


Rotate Data
Does anyone know if you can or how to rotate data in Excel?

I have data that is imported from a database and the income is load in colums. But I need the information to be horizonal in rows for example
instead of:

1 2 3 4
1 2 3 4
1 2 3 4

I want it to be

A 1 1 1
B 2 2 2
C 3 3 3

(Note: A, B & C being the heading of each col)

Thanks guys

Help With Rotate Rota
I have the follwing code, which works fine up to a point, but what i need it to do is also rotate the col next to it ie where as range b10:b23 it also needs to do the same with range c10:c23 as the information in those cells are related to each other, when i change my set rng =range("b10:b23,c10:c23") the information in col c ends up in col b and the info in col b vanishes
Sub rotate()

Dim rng As Range: Set rng = Range("b10:b23")
Dim rng2 As Range: Set rng2 = Range("b24:b39")
Dim v As Variant
Dim n As Variant

v = rng(rng.Rows.Count).Value
n = rng2(rng2.Rows.Count).Value
rng.Value = rng.Offset(-1, 0).Value
rng(1).Value = v
rng2.Value = rng2.Offset(-1, 0).Value
rng2(1).Value = n

End Sub


Rotate Image
is there a way to rotate an image a certain amount of degrees? i want to make sort of a GTA1 or 2 type thing. I was thinking about just using different images for each angle, but that would take a long time, and i would have to deal with transparancy and stuff.


Rotate Image
I do not want to create 10 different images, because I want to be able to have it like this:

Each time the user clicks the left arrow button, the image roates 12 degrees to the left. Same thing with the right arrow.

Any ideas?

Jacob Sheehy

Rotate Label
I would like to know if there is a way or a control that I can rotate the control a given degree.
As simple as rotating 90 degrees.
I want to use this functionality with a label or label like control.

Rotate Datagrid

i was wondering if there's an easy way to rotate a datagrid control ( i mean, swapping rows with colums like:

a b c d
e f g h


a e
b f
c g
d h


Any idea?


Ok so the title was just to get your attention.
Basically I am seeing if it is possible to have visual basic open every word document in a given folder, run a program on each document and then save each new document to another folder but with the same name as the original. If it can be done how do I do it?

Rotate By Angle (in Dx)
how can I rotate the object(dx) by angle???

Copyright 2005-08, All rights reserved