|
-
Jun 7th, 2007, 05:27 AM
#1
Thread Starter
Hyperactive Member
Last edited by Hassan Basri; Jun 7th, 2007 at 06:58 AM.
-
Jun 7th, 2007, 07:51 AM
#2
Re: X Marks the Spot / Position an Image Exactly Outside a Picturebox
Some ideas and questions:
-1-
According to your: "I want to position the Image (imgDirection) exactly to where the line is pointing AND remain outside the black square." The imgDirection should be just ouside the black square, but in your code you put in relation to the picCircle? Which is correct? From my point of view the picture attached is not corresponding to the code posted!
-2-
Calculate the center of your imgdirection using the direction of your line (I think you have that as dblDirection). With the line you had a fixed length all the time, in here you need the length to be a functiion of the direction. If you are using he degree-system 0 or 360 is North(to the top) 90 is East(to the left).
All angles between 315 and 045 use a fixed Top (Top of black square - half height of imgDirection) and a calculated Left (Left of black square +((half of (width blacksquare +width of imgDirection)*tan(direction))
All angles between 45 and 135 use a calculate Top (Top of black square - ((half of (heigthof blacksquare +heigth of imgDirection)*cotan(direction)) and a fixed Left (Left of black square +half of width of imgDirection) ... and so forth
Note check the + and -, they migth be to the wrong side, I justed typed that one in!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Jun 7th, 2007, 07:55 AM
#3
Re: X Marks the Spot / Position an Image Exactly Outside a Picturebox
You cheated, you changed the threat while I was writing an answer on the original text. Now you have a black circle insted of the black box. That would be fairly simple, you have the distance fixed (calculated from the centre of all your circles), so use the same routine that calculated the endpoint of the line to calculate the center point of your imgDirection!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Jun 7th, 2007, 11:24 AM
#4
Thread Starter
Hyperactive Member
Re: X Marks the Spot / Position an Image Exactly Outside a Picturebox
Hello Opus, thank you for your input. Sorry I edited my post a few minutes after writing it as I realized that a circle would be easier then a square. In any case the black circle is just for distance purpose in the final result it will be invisible.
How would I calculate the .Left and .Top of the imgDirection once I calculate that distance? As the endpoint of the line is the radius with an angle inside a picturebox. However the coordinates I need is for the imgDirection which is .Left amd .Top. Any ideas?
-
Jun 7th, 2007, 04:27 PM
#5
Re: X Marks the Spot / Position an Image Exactly Outside a Picturebox
I would consider the calculated points as the center of the imgDirection (if you used the radius of that circle + half the width of imgDirection. The .Left and the .Top will then be just a fixed offset to the calculated point ( -0.5*Heigth and -0.5*Width).
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Jun 8th, 2007, 03:34 PM
#6
Thread Starter
Hyperactive Member
Re: X Marks the Spot / Position an Image Exactly Outside a Picturebox
Thank you opus for your assistance. In the end this was my solution for all angles, I multiply by a factor and it gives me the result I want.
Code:
imgDirection.Left = 2 * LQ.X2
imgDirection.Top = 2 * LQ.Y2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|