Hello everybody,
Please look at the attached image to understand my question.
I have 1 Main PictureBox. Inside that PictureBox is a second PictureBox (picCircle) with a Circle and a Line Object (LQ) from the Center to the edge of the circle. In the First PictureBox I also have an Image (imgDirection) (the Yellow X) and a black circle.
Here is my question. The line (LQ) in the center of the circle can move to any degree between 0 and 360. I want to position the Image (imgDirection) exactly to where the line is pointing AND remain outside the black circle. Currently I am doing this by trial and error and this is what I came up with which seems Ok but is there a better and exact way? Thanks for any assistance.
Code:Select Case dblDirection Case -180 To -150 imgDirection.Left = (picCircle.ScaleWidth / 2) + LQ.X2 imgDirection.Top = (picCircle.ScaleHeight / 2) + 1.3 * LQ.Y2 Case -150 To -110 imgDirection.Left = (picCircle.ScaleWidth / 2) + 1.3 * LQ.X2 imgDirection.Top = (picCircle.ScaleHeight / 2) + 1.2 * LQ.Y2 Case -110 To -30 imgDirection.Left = (picCircle.ScaleWidth / 2) + 1.3 * LQ.X2 imgDirection.Top = 1.5 * LQ.Y2 Case -30 To -10 imgDirection.Left = (picCircle.ScaleWidth / 2) + 1.1 * LQ.X2 imgDirection.Top = 1.5 * LQ.Y2 Case -10 To 45 imgDirection.Left = 1.5 * LQ.X2 imgDirection.Top = 1.2 * LQ.Y2 Case 45 To 100 imgDirection.Left = LQ.X2 imgDirection.Top = 1.5 * LQ.Y2 Case 100 To 165 imgDirection.Left = 1.1 * LQ.X2 imgDirection.Top = (picCircle.ScaleHeight / 2) + 1.3 * LQ.Y2 Case 165 To 190 imgDirection.Left = (picCircle.ScaleWidth / 2) + LQ.X2 imgDirection.Top = (picCircle.ScaleHeight / 2) + 1.3 * LQ.Y2 End Select




Reply With Quote