Tracker
 ASP PHP JavaScripts MySQL MS Access MSSQL Subjects/Titles Post Text/Content
HOME    TRACKER    Visual Basic

# 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 sections2) 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.

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
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 ***

Code:
Gun.position = test2
Gun.OpenWorld
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
Gun.RenderObject
it works but i doesn't go with it up

Rotating
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?

Rotating
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

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).

Thanks
Anthony

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

Rotating Picturebox
hi
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.

Thankyou

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.

Thanks

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:

Code:
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 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
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
'
'
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
Picture2.Cls
'
' 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
Else
'
' 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.

Regards
Doug

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

Rotating A Surface
Hi
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?

thanks.

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
Ellow,

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
Code:
Dim x As Single
x = Sin(count)
ShotGun.rotate x, 0, 0
this works but when i do this:

Code:
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

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 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)

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 Text Box
Can You put label and text boxes on an angle?

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

Rotating Bitmaps
How can I Rotate a Bitmap using only 2 Pictureboxes. I've been having trouble understanding other code on the net. Please if someone knows of an easy way to do it, let me know. Thanks.

GrimViper

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,

Nick.

Rotating Images
Does anyone know how to rotate an image on a form. For instance I want to rotate an image from up to down or right to left depending on what key I press. Any help would be greatly appreciated. Preferably a picture box. Thanx in advance.

Rotating Pictures
If Anybody Has ANY IDEA On How To Rotate A Picture (Image) Then Please Can You Help Me Out...I'm Sure There Are Also Alot Of Other People That Wouldn't Mind Knowing How It's Done

Tank You Vedy Much

Rotating Images
How do you make images rotate?
Is there a way to do this outside of DX?

Rotating Images
How do you rotate images?
Well, what is the easiest way outside of DX?

Trying to make an asteroids game, and being able to rotate the image will cut off multiple images of the same object but in different facings...

Help With Rotating Images
i made an application of a yield sign.. & it's going to appear as if it's spinning. i have 3 different pics but when i go into the form load saying which picture is visible.. i used sub procedures to draw the signs.. but how do i say something like "picSign.Visible=True" for a sub procedure? if this helps you understand:

Code:
Option Explicit
Private intIncrement As Integer

End Sub
Sub DrawSideOfSign()
picSign.DrawWidth = 20
picSign.Line (2040, 2280)-(2040, 240), vbRed
picSign.DrawWidth = 5
picSign.Line (2040, 2400)-(2040, 3480), vbBlack
End Sub
Sub DrawBackOfSign()
picSign.DrawWidth = 20
picSign.Line (360, 240)-(3600, 240), vbRed
picSign.Line (360, 240)-(2040, 2280), vbRed
picSign.Line (3600, 240)-(2040, 2280), vbRed
picSign.DrawWidth = 5
picSign.Line (2040, 2400)-(2040, 3480), vbBlack
End Sub
Sub DrawFrontOfSign()
picSign.CurrentX = 1800
picSign.CurrentY = 800
picSign.Print "YIELD"
picSign.DrawWidth = 20
picSign.Line (360, 240)-(3600, 240), vbRed
picSign.Line (360, 240)-(2040, 2280), vbRed
picSign.Line (3600, 240)-(2040, 2280), vbRed
picSign.DrawWidth = 5
picSign.Line (2040, 2400)-(2040, 3480), vbBlack
End Sub

Rotating Pictures
Is it possible to rotate a picture using API functions? I don't want to use DirectX/OpenGL 'cause my program doesn't use them.

Rotating Coordinates
Hi guys,

My maths is somewhat rusty so I was hoping someone with a better understanding may be able to help.

I have a circle with a line inside (see attached - but excuse the poor image ). When the user clicks around the circle I wish to draw a straight line from the center of the circle to the x-y coordinate of the click.

I also wish to rotate the line within the circle at 90degrees to the line extending from the circle's center – how do I determine at which points to draw this line?

I hope that makes sense.