naresh pareek
August 23rd, 2001, 09:46 AM
how we create a small circle at the edge on another circle and move this small circle on it like a clock
|
Click to See Complete Forum and Search --> : round circle naresh pareek August 23rd, 2001, 09:46 AM how we create a small circle at the edge on another circle and move this small circle on it like a clock berta August 23rd, 2001, 10:08 AM >we create a small circle To create a circle U can use function circle. Circle [Step](x, y), radius[, color] This function creates a circle on a form, with API FillRgn [Public Declare Function FillRgn Lib "gdi32" Alias "FillRgn" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long) As Long ] also U can fill it. hi, brt John G Duffy August 23rd, 2001, 10:56 AM You can also use the SHAPE control. It provides a variaty of shapes, Rectangles,Squares,Circles Ovals etc. it provides for line types,width, Fill Patterns, etc John G Kdev August 23rd, 2001, 12:11 PM Use the shape control to make a circle on the form and set its index property to 0. Make sure that the width and height are the same so it is a circle and not an oval. Then add a timer and a command button and paste this code to the form. private Sub Command1_Click() If Shape1.Count = 1 then Load Shape1(1) Shape1(1).Left = Shape1(0).Left + Shape1(0).Width Shape1(1).Top = Shape1(0).Top + (0.5 * Shape1(0).Height) - (0.125 * Shape1(0).Height) Shape1(1).Height = (0.25 * Shape1(0).Height) Shape1(1).Width = (0.25 * Shape1(0).Width) Shape1(1).Visible = true Timer1.Interval = 250 Timer1.Enabled = true End Sub private Sub Timer1_Timer() Dim nRadius as Integer, nX as Integer, nY as Integer Const pi = 3.14159265358979 static nAngle as Integer nRadius = 0.5 * (Shape1(0).Width + Shape1(1).Width) nAngle = nAngle + 10 If nAngle > 360 then nAngle = 0 Timer1.Enabled = false Exit Sub End If nX = Cos(CDbl(nAngle) * pi / 180) * nRadius nY = Sin(CDbl(nAngle) * pi / 180) * nRadius Shape1(1).Left = Shape1(0).Left + 0.5 * Shape1(0).Width + nX - 0.5 * (Shape1(1).Width) Shape1(1).Top = Shape1(0).Top + 0.5 * Shape1(0).Height - nY - 0.5 * (Shape1(1).Height) End Sub This will draw a circle 1/4 the size of the initial circle and place it on the right edge of the large circle. It will then rotate the smaller circle around the larger circle in revolutions of 10 degrees every .25 seconds until it has made 1 full revolution. -K codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |