Click here to Skip to main content
15,888,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys! So, a friend and I are creating a game map with dynamically updating features. We use this to track members of our squad and vehicles. Basically it is our custom built radar.However, it is for personal use we never use it online. Moving on we use this to draw the map.
C#
e.Graphics.DrawImage(global::Radar.Properties.Resources.bigmap, 0, 0, 980, 980);

Which in turn gives me this.
Map.jpg[^]
Which is nice and all but considering m map is in the 5000X5000 resolution range I would love to make it much bigger. So, being new to the coding world I decided to do this.
C#
e.Graphics.DrawImage(global::Radar.Properties.Resources.bigmap, 0, 0, 5000, 5000);

Which in turn gives me this.
Map2.jpg[^]
I hate it because I am not able to pan the image around in anyway. Some people have suggested that I use a picture box but I have not idea how to convert what I have to a picture box. If that is the only option please explain to me how I would go about doing it.
Posted
Updated 18-Aug-12 11:48am
v3
Comments
Kenneth Haugland 18-Aug-12 18:28pm    
What do you hate? The zooming not working or what? The pixel resolution of your screen? I dont understand , please clarify.
Member 9290385 18-Aug-12 19:03pm    
"I hate it because I am not able to pan the image around in anyway." Just like it says. I would like to be able to zoom in and out on the picture and pan it around.

1 solution

A viewbox would suffice in WPF, a PictureBox could do it but others have better ideas:
http://www.bobpowell.net/zoompicbox.htm[^]
 
Share this answer
 
Comments
Member 9290385 18-Aug-12 20:30pm    
Can you explain to me how I would incorporate the e.Graphics.DrawImage(global::Radar.Properties.Resources.bigmap, 0, 0, 980, 980); into that? Also would I put that in Form1.cs or Map.cs (Where the "e.Graphics.DrawImage(global::Radar.Properties.Resources.bigmap, 0, 0, 980, 980);" code snippet is stored.)
Kenneth Haugland 18-Aug-12 20:38pm    
He creates a new user control and uses that insted of a PictureBox, becouse a picturebox would have to be modifyed just as much in the first plase. Just follow his steps and use the control as he suggests, and you'll be fine.
Member 9290385 18-Aug-12 23:44pm    
I am greatly sorry to keep pestering you like this as I am sure you have better things to do but I am relatively knew to C#. I created a new user control and entered the mentioned code. However it gives me at least 41 errors every time. However, when I enter it in my Map.cs class no errors occur but nothing happens when I debug either.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900