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

Rotating Text

HI People!

I'm printing text to a picturebox as column headings... of course many of the strings are long than the column widths. So is there a way of rotating the text so it's vertical rather that horizontal??

Much Regards,


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Rotating Text: How Do You Print Rotated Text To Printer?
I am fimilar with the means to rotate text at any degree and then display it on a form. But how do you print rotated text to the printer? And how do you do it not as pixels but in high resolution (the same resolution as when you use the print command)?
Printer.Print "How to rotate text."

Rotating Text
I've searched time and time again, and I can't find what I need...

I can use Textbox, Picturebox, or label, it doesn't matter...

I need to rotate... a barcode, yes a barcode...

90 degrees...

I can do this on the form (surface of the form) but I can't get it to be on top of any items (The problem is it needs to be on the frame)

Any helpful code?

Rotating Text Box
Can You put label and text boxes on an angle?

Rotating Text
Hi All,

I'm still having problem to having a rotating text/label. Is there any efficient way to achieve this?

any help will be greatly appreciated


Rotating Text
Is there a text box that can rotate or a way to print text rotated 90
degrees? I've been looking but can't find anything.

Rotating Text
Hi All.

I'm trying to print rotated text to go around a circle with both a printer and picture box control. Ideally i would be able to rotate the text any angle from 0-360degrees and if possible use any font. If that is impossible i might have to create some vector based characters and work with them.

Can anyone offer any help / suggestions?

Rgds from Downunder,
Sydney, Aust.

Rotating Text With Mouse

i have problem to rotate the text in project is of image editor in which i want to enter some text and rotate it as per the user need with mouse.i dont have any idea about this so please help me.


Rotating TEXT In PictureBox

We're trying to draw a geographic grid (successfull) in
a PictureBox - BUT we now need to place text along the
grid lines. This means rotating one set of text through
90 degrees.

This was dead easy in Borland Pascal for DOS from 1992.
BUT for some reason it's not even mentioned in Microsoft
VB6 1999 vintage.

Am I missing something here or is Visual Basic about 10 years behind the times in functionality?

Any help on displaying rotated text would be much appreciated.



Rotating Form's Text (by 90 Degrees CCW)
I would like to rotate text on a form by 90 degrees Counter Clock Wise).
1. Is there a way to place a text directly on a form (ie not using label or text box)?
2. Is there a way to rotate the text?
3. is there a way to place a rotated label on a form and then place text in the label that will appear tilted (rotated)?
Perhaps there is a third party Add-In / components that I can use?

Print A Rotating Text From A Picture Box
I used the rotating text to have an inclined text in a picture box but i tried to print it with my printer (Really, with a printer!!!) but nothing appears on the paper...
what should I do?

Rotating Text On Display And Printing
I am trying to write some kind of a labels package. When of the things i need to do is print text rotated by 90 degrees, when i preview the document and when sent to printer.
Any tips/ideas would be greatly appreciated.
Thank you.

I have an image in a memory DC, and i want to rotate it within memory before i bitblt it onto a picture. Does anyone know the fastest way to do this? Thanks in advance.

Rotating XYs
I need a function like this :

Public Type XY
X As Long
Y As Long
End Type

Function RotateXY(Center as XY, Angle as long, PointToRotate as XY) as XY
End fuction

'Dim Cen,Point as XY
'Cen.X = 2
'Cen.Y = 2
'Point.X = 2
'Point.Y = 1
'RotateXY(Cen, 90, Point).X will return 3
'RotateXY(Cen, 90, Point).Y will return 2

Help me make the "RotateXY" function, thanks

Gun Rotating
Hi folks,

i have made i gun in 3dsmax and converted into an .x model. I want it to rotate with the camera rotation but i don't know how exactly.
Like in all fps i want it to stick next to me:

i Have point A and the weapon must rotate about .5 away from point A
The weapon is at 90degrees on the right of Point A.
how can i do this?

*** EDIT ***

Gun.position = test2
Gun.rotate (pi / 2) + ViewingAngle, 0, 0
Gun.move Sin(ViewingAngle + (pi / 2)) * 0.5 + test2.x, Gun.position.y, Cos(ViewingAngle + (pi / 2)) * 0.5 + test2.z
it works but i doesn't go with it up

How do you rotate a picture in a picture box or on a form by ? degrees(Maybe API)?

Rotating TXT
Can sum 1 which a brain help me? i know how to make txt flash on VB but is it possible 2 make the TXT spin around or rotate?

Hello , i wanted to find out if there is someone
who knows how to take an image box (or picture box or whatever) and rotate it around it self

i can do it in pascal at real mode
but only with SINCOS formulas and to take the center as X,Y(0,0) , if anyone knows a better way in visual basic
to rotate in degree/Radians please reply me

Thank You

Rotating Pictures
hey can I rotate a simple 2d image somehow in vb without having a seperate picture file for each rotation angle?

Rotating An Image Using GDI+
I am looking for a way to rotate an image by X degrees. (ie not the rotateflip function)

I found the GdipRotateWorldTransform function that seemed to fit the bill but havent yet got it working properly.
If anyone can shed any light on what Im doing wrong I would appreciate it.

My first try :

Public Function RotateImage(ByRef hImage As Long, ByVal angle As Single)
Dim uOrder As MatrixOrder
Dim retval As Long
Dim hGraphics As Long

If IsAGoodImage(hImage) Then
uOrder = MatrixOrderPrepend
retval = GdipGetImageGraphicsContext(hImage, hGraphics)
retval = GdipRotateWorldTransform(hGraphics, angle, uOrder)
retval = GdipDeleteGraphics(hGraphics)
End If
End Function

When this didnt work I thought it might be because the graphics was being destroyed and not being applied. So I thought, the way to apply the change is to draw it.
So then I tried this:

Public Function RotateImage(ByRef hImage As Long, ByVal angle As Single)
Dim uOrder As MatrixOrder
Dim retval As Long
Dim hGraphics1 As Long
Dim hGraphics2 As Long
Dim hClone As Long

If IsAGoodImage(hImage) Then
uOrder = MatrixOrderPrepend

'because any changes to Graphics arent written to the image until it is drawn
'we need to make a copy of our original image
'then rotate this
'then draw those changes back onto our original image
'at least... thats the plan
retval = GdipCloneImage(hImage, hClone)
'get graphics of the images
retval = GdipGetImageGraphicsContext(hClone, hGraphics1)
retval = GdipGetImageGraphicsContext(hImage, hGraphics2)
'rotate the cloned image
retval = GdipRotateWorldTransform(hGraphics1, angle, uOrder)
'and then draw that change back onto the original image
retval = GdipDrawImageI(hGraphics2, hClone, 0, 0)
'clean up
retval = GdipDeleteGraphics(hGraphics1)
retval = GdipDeleteGraphics(hGraphics2)
retval = GdipDisposeImage(hClone)
End If
End Function

But, it still doesnt work.

Anyone got any ideas?

Rotating A Bitmap
I would like to be able to rotate a bitmap image (in a PictureBox) 360 degrees.

I have little graphic experience, and don't know where to start.

Could someone point me to a tutorial or something else, to get me started in the right direction.

Rotating A Picture In VB6
How i can load a picture in an imange control and if the orientation is not correct rotate it? Thanks for the help.

Rotating Controls???
Is it possible to rotate controls of any sort but especially label, image and user controls. I want to be able to rotate my image controls with the mouse. I'd also like them to rotate by any degree the user specifies (not just 90, 180 etc).


Rotating A Image
I'm developing a photo album ind need a method that rotates a image fast. The image is in picturebox.

Can somebady help me? Please be detailed i'm noobie.

Rotating Picturebox
is there any way to rotate a picturebox together with its border. i don't want to rotate just the picture but i want to rotate the picturebox on the whole.


Rotating Objects In VB
Hi guys,

At my highschool, we've learned how to move objects (i.e. shapes) in horizontal and vertical directions. We were then able to apply this idea to move objects diagonally.

However, we've never actually learned how to rotate objects, i.e. objects that rotate on a fixed axis, like the hands on a clock.

How can I rotate a line so that one end of the line remains in a fixed location, while the other end traces the path of an arc?

A 90 degree rotation, or a distance of pi/2 will suffice.


Rotating Shapes
hi i need to make a fan rotate, for the "wings" of the fan i used 4 shapes in a control array, but how do i make it turn...

Rotating An Image
Hi all,

I'm trying to rotate an image:

Option Explicit
Private Const PI As Long = 22 / 7
Private Declare Function SetPixel Lib "gdi32" _
(ByVal hdc As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal crColor As Long) As Long

Private Declare Function GetPixel Lib "gdi32" _
(ByVal hdc As Long, _
ByVal x As Long, _
ByVal y As Long) As Long

Private Sub cmdDraw_Click()
Dim lngColour As Long
Dim intOriginX As Integer
Dim intOriginY As Integer
Dim sngAngle As Single
Dim sngRads As Single
Dim lngY As Long
Dim lngY1 As Long
Dim lngX As Long
Dim lngPointY As Long
Dim lngPointX As Long
Dim lngLength As Long
Dim lngLen As Long
Dim lngReturn As Long
sngRads = PI * 180
lngColour = vbBlack
Picture1.ForeColor = lngColour
Picture1.ScaleMode = 3
' Origin values define the centre of the Image
intOriginX = Picture1.ScaleWidth / 2
intOriginY = Picture1.ScaleHeight / 2
' Draw the cross hairs through the Origins
lngY = intOriginX
lngLen = 20
For lngX = intOriginX - lngLen To intOriginX + lngLen
lngReturn = SetPixel(Picture1.hdc, lngX, lngY, vbBlack)
Next lngX
lngX = intOriginX
For lngY = intOriginY - lngLen To intOriginY + lngLen
lngReturn = SetPixel(Picture1.hdc, lngX, lngY, vbBlack)
Next lngY
' Draw the Arrow Head
lngLength = 10
Picture1.ForeColor = vbRed
For lngY = intOriginY To (intOriginY + 30) Step 2
For lngX = 0 To lngLength
For lngY1 = lngY To lngY + 2
lngReturn = SetPixel(Picture1.hdc, intOriginX + lngX, lngY1, vbRed)
lngReturn = SetPixel(Picture1.hdc, intOriginX - lngX, lngY1, vbRed)
Next lngY1
Next lngX
lngLength = lngLength - 1
Next lngY
End Sub

Private Sub cmdRotate_Click()
Dim lngX As Long
Dim lngY As Long
Dim lngX1 As Long
Dim lngY1 As Long
Dim lngXMin As Long
Dim lngYMin As Long
Dim lngReturn As Long
Dim lngColour As Long
Dim sngAngle As Single
Dim sngSin As Single
Dim sngCos As Single
Dim intOffSetX As Long
Dim intOffSetY As Long
Dim lngBack As Long
Dim lngLen As Long
' Ensure both PictureBoxes are identical in dimensions
' and (important) configuration
Picture2.ScaleMode = Picture1.ScaleMode
Picture2.ScaleWidth = Picture1.ScaleWidth
Picture2.ScaleHeight = Picture1.ScaleHeight
Picture2.Width = Picture1.Width
Picture2.Height = Picture1.Height

Picture2.BackColor = vbWhite
' Get the background colour
' It's used later to stop the process from
' copying the background to PictureBox2
lngBack = GetPixel(Picture1.hdc, 0, 0)
' OffSet values define the Rotation Point
' (They just happen to be in the centre of the Image)
intOffSetX = (Picture1.ScaleWidth) / 2
intOffSetY = (Picture1.ScaleHeight) / 2

lngColour = vbBlue
' Angle of Rotation
sngAngle = 180
' The angle doesn't change so its outside of the loops
sngSin = Sin(sngAngle * PI / 180)
sngCos = Cos(sngAngle * PI / 180)
' Perform the rotation
lngXMin = 0
lngYMin = 0
For lngY = lngYMin To Picture1.ScaleHeight - 1
lngX1 = (((lngXMin - intOffSetX) * sngCos) + ((lngY - intOffSetY) * sngSin) + intOffSetX)
lngY1 = (((lngY - intOffSetY) * sngCos) - ((lngXMin - intOffSetX) * sngSin) + intOffSetY)
For lngX = lngXMin To Picture1.ScaleWidth - 1
' Ensure that the Pixel is within the PictureBox
If (lngX1 <= Picture1.ScaleWidth - 1 And lngX1 >= 0) _
And _
(lngY1 <= Picture1.ScaleHeight - 1 And lngY1 >= 0) Then

lngReturn = GetPixel(Picture1.hdc, lngX1, lngY1)
If lngReturn <> -1 Then
' Check if this is the background colour
' if it is then ignore it
'(Commented out so the background can be seen)
'If lngReturn <> lngBack Then
lngReturn = SetPixel(Picture2.hdc, lngX, lngY, lngReturn)
'End If
' This shouldn't happen
' (I think) but it does
Debug.Print lngX1; " "; lngY1
End If
End If
' Increment the values
' (Put here to reduce the amount of calculations
' both values increase by a fixed amount each time
' through the loop)
lngX1 = (lngX1 + sngCos)
lngY1 = (lngY1 - sngSin)
Next lngX
Next lngY
MsgBox "End"
End Sub
Subrotine cmdDraw creates the Image in PictureBox1 and cmdRotate should rotate it by 180 degrees and draw the rotated object in PictureBox2.
Well, it has a very good go but it's not quite there. I end up with about a 160 degree rotation, the problem being, I think, that the codes is going outside of the boundaries of PictureBox1 and I can't for the life of me work out how or where. (I've posted all the code as it's easier to see the problem by actually running it - at least it's easier for me !)

Any help would be greatly appreciated.


Rotating Circle.
i'm making a wheel of fortune clone so i need somehelp with the 'wheel'.
1) how do i create a circle that is divided up into 20 or so different sections
2) how do i print the money TEXT on those pieces so it is sideways like in the tv show wheel.
3) how do i rotate the circle (some sort of trig function?)
4) when the wheel stops on a certain point (say 12'o clock) how do i determine what money value stopped on that marker.

thanks for any help.

Rotating Pictures?
is there an easy way (like an API or soemthing) to rotate pictures like any rotation I want to?

Rotating A Surface
Are there anyone who know how to rotate a surface. I know i should use DDBLTFX type. But i dont know how. I am using DirectX 7.

Rotating A Shape
Say, I have an array of vertices which represent a shape, (eg 4 verticies could represent a square). I could draw the shape quite easily using the Line function. Now how do I rotate the shape through a certain angle given a pivot point? I think this has something to do with matrix transformation but all the articles I can find on this subject talk about 3D coordinates and go into more depth than I'd like. Does anyone know of a simple solution?

Rotating, And Angles...
So i have checked out OnErrors script for rotating images...

i am making a 2d shooter game, set up like the first GTA. I was wondering if there was any (easy) way to make the sprite move at a certain angle, reletive to the angle in which the image was rotated...

currently now it rotates the image, and the movement looks more humorous than realistic.

any help, suggestions... code?


ps - i am reletively new to VB, so go real easy on me please.

Rotating Images
I just need to rotate a small image for asteroids, 40 x 40. Since I am only in 8th grade I dont know how to use Sign/Cosign/Tangent. (I think thats what theyre called) And i think i need them for this operation, BUT I DONT KNOW HOW TO USE THEM! Plz help. All i need is the code, and i dont know how to attach images otherwise i would show you it. And its not online, its made by me.

BitBlt Rotating

Does someone know if (and if how ) you can rotatate, mirrow etc.. something using BitBlt.???

Also....I know this can be done with DirectDraw but my Englisch ant very well and directx4vb is for my too hard to understand. Does someone know an other site?

Sorry 4 my stupidety

A 3D-rotating Cube
hi at all,

i'm a newbie in programming DX 3D.
In the last weeks i startet with DirectDraw and so i've coded a little 2Darcade-game to learn it and get experience in easy game programming.

now that 2D stuff is not interesting anymore.
but i've a problem to get over that wall of 3dprogramming.

i've set my self the goal to programm a 3d cube or something like that which is rotating. The sides of the cube should get bitmaps on their surfaces.

to blit an image on a 2d surface is easy..but how do i build an object with more side than one ?

and how can i get images (on the sides) in perspective ?

are their directX Features to rotate an multisided object by changing the coordinates of one specified edgepoint of this object

if i had answers for all that could i begin ? please correct me, if i am on the wrong way..

Has anyone seen an open source example in vb for that ? (a nice link for me,etc..)

thank you for any posts our helps

Rotating Image
i got keydown and keyup events

on keydown
if vbkeyleft is pressed
then mveleft = 1 ' this will move the image rotating left
end keydown

on keyup
if vbkeyleft is released
then mveleft = 0 ' this will stop moving the image rotating left
end keyup

now if the left key was pressed and then released while the image has rotated only 50 degrees. and then the up key is pressed how will i make the image moving forwards instead of moving up?

Rotating Images
i am making a race track program that has two images, they "race" eachother around a circular track (like the dot races at the ball game), but my problem is when the images get the a part of the track when the need to turn, i can make the images move in a diferent direction, but they are orientated wrond, so they finish the race upside down.

any ideas on how to rotate the imgaes

Rotating And Mirroring
how can i rotate and mirror it

Rotating A Picture
Ok I want to make a program that allows me to have a picture (eg JPG,BMP,GIF) rotate, like in the paint programs that you can put them on angles.
(eg 45 degrees, 12 degrees)

Maybe someone could make an example program like have a text box that you type in how much you want the image rotated
and a image box with some image in it, which would be rotated


Pictures Rotating
can you rotate an image
If you could send me a example code it would be greatly apreciated

Rotating Sprites On The Fly
Is there any practicle way to rotate sprites during runtime that doesnt take a minute to do? I'm working a 2d space game using DirectDraw and a ship that is drawn in the same way the asteroids ship is, just 4 lines the make a little ship, and I can rotate it easy by simply moving the points that draw the lines. But using lines to have a ship leaves a nice gaping hole in the middle which I would like to be filled with color. The easiest way I see of doing this is to just use a sprite, and it would be even easier if I could make one sprite and just rotate it instead of making alot of them to keep ship rotating smooth.

Rotating Images
How can you rotate images in Direct X? Would you use an API or a function?

Rotating Image In Dx8.1
how can this be done? I need to rotate it like you would a 2d image since my game is going to be 2d, so I have no matrixes.

Rotating Problem
Dim x As Single
x = Sin(count)
ShotGun.rotate x, 0, 0
this works but when i do this:

Dim x As Single
x = Sin(count)/100
ShotGun.rotate x, 0, 0
it doesn't work. Why is this because it doesn't make sense

Help In Rotating Circle
Hello. I am controlling servo motor with mscomm control. I can rotate the motor with visual basic. But i also want a visual effect in my form which rotates a circle at a specific angle regarding to how long i push the button. What must i do? Thanks for your help...

Rotating A Picture
does anyone know how i could easily rotate a picture without it being in a picture box?
thnx for any suggestions

Rotating An Image?
is there a very fast way to rotate an image at runtime? I need to be able to rotate it any amount too.

Rotating Shapes
Is it possible to rotate shapes (eg. Rectangles) in VB? If so How would I go about doing it.

Rotating Objects
Is it possible to rotate objects in VB? (eg. 45 degrees)
Any suggestions would be appreciated

Copyright 2005-08, All rights reserved