last day (16 days later) » 

09:08
2
A: Problem with a Moving & Rotating Map?

George DuckettThe problem you're having is that you're creating a new bitmap with the map moved, before rotating it. You need to rotate the image, then translate/move it. Possibly a better approach is to use the Matrix.Rotate() and Matrix.Translate() methods to get a matrix to set the Graphics.Transform to....

Arrrrr... i'm really having hard time with this! lol
I hate Matrix Translation and all of this..
Can you show me a piece of code.. i'm sure it wont be more then 5 lines..
See my edit for an example.
Hey thx, thats exactly what i did.. but the problam is that it's rotating on the Top Left Corner and not from the center.. so it masses all up lol.. i thought i did something wrong.
How can i make it rotate from the center?
See my edit, at the bottom of my answer.
See my new edit... still facing the same problem..
09:08
FYI, you shouldn't edit your question so much it changes it, just add edits to the bottom. I don't understand your problem, or what you want. Maybe pictures describing what you want will help?
I've added a complete sample of what i think you want to achieve to the bottom of my post.
Hey your code works great.
But still i have a problem i'll add pictures so you can understand.
Ok, i understand now. Instead of translating by half the image width/height before and after the rotation, translate by the coordinates of the red cross (i.e. half the map window/radar size).
I added my cross drawing to the code.
The problem is that the red cross is always at the center of the map window. and has diffrent coordinates of the map..
I didn't understand the calculation i need to make..
Translate it by rc.Width / 2 instead of image.width / 2. The key is what i said in my answer: "The way you can get around this is to first translate the image so the point you want to rotate around is on that origin". You know that without any translation the image rotates around the top left. So, to get it to rotate around where the red cross is, you need to move the image so that the red cross would be on the top left. Then you do the rotation. Of course you've also got to move it back. In my program, try removing all matrix lines, adding them in one by one.
translating it by rc.Width/2 wont do the trick..
try downloading my image [mediafire.com/?su6ec3ctc3upq15](http://www.mediafire.com/?su6ec3ctc3upq15)
and copy my code so you can see whats the problem..
notice that the Map Widnow has diffrent coordinate count then the coordinate count of the image.
I hope you understand what i'm tryng to say.
Hey
You here ?
09:10
Hi, i am, however i'm pretty busy at the moment, i'll have to look at this tomorrow. I'll alter my program to use your image file, and always rotate around the center of the form.
Hey, thx but the problem i think is that you use a form and not a PictureBox like i do.
Notice that the picture box has diffrent coordinate then the picture
i think it's because my PictureBox.SizeMode = CenterImage
And thank also for you help :)
09:47
That is definitely making a difference as it's changing where the picture is drawn, which probably changes the rotation. Try changing the sizemode to Normal.
I just change the size mode to normal and tried few diffrent translations, it's still not good
thats why i want the picture to rotate from the center, because i used CenterImage and the cross were on the center./
When the cross is on the center it works and rotates good. only get massed up when i move the Y axis
The center image just centers it for the first time, doesn't effect it after i start moving/rotating
10:07
I definitely think you should have the sizemode as normal, as anything else will complicate things. When you say 'move the y axis' what do you mean? You should be doing a Matrix.Translate(..., ...., Append).

  last day (16 days later) »