Forumchem - Forum with AI(ALICE BOT & HAL9000) and TTS

More dificult for us, more easy for you
It is currently Tue Jun 25, 2019 5:30 pm

All times are UTC





Post new topic Reply to topic  Page 1 of 1
 [ 1 post ] 
Author Message
 Post subject: Fastest way to draw a map c# in windows form?
PostPosted: Sun Apr 21, 2019 12:28 pm 
Offline
User avatar

Joined: Fri Oct 16, 2009 8:22 pm
Posts: 10
currently I use a multidimensional string to store the map..I have 4 buttons up,down,left,right for movement and each corresponds to a coordinate in the string.and the current coordinate is stored in int currentX and int currentY.
so when I click Up the X(you) will move up so from (1,1) I will be at (0,1).
I have no problem if the map is just less than 30x30. the map updates right away.
the problem is we need to use a large map 50x50 map. So when I click a button it takes time to refresh cuz the program will understandable the string and draw again the map through a loop
psuedo:
(if x == currentX, y==currentY then lblMap.Text += "X" else lblMap.Text += "O")

what do you recommend that I should do instead of this?. im using vstudio by the way void PrintMap()
//windows form brand
lblMap.Text = "";
for (x = 0; x <= grid.GetLength(0) - 1; x++)
for (y = 0; y <= grid.GetLength(1) - 1;; y++)
if (x == xCoor && y == yCoor)
lblMap.Text += "X"; // X is where you are
else
lblMap.Text += "+"; // + is just an unoccupied space

lblMap.Text += "\\n";

pardon the spacing. I just compressed it due to the limit of yahoo..by the way I just noticed I didnt actually used the string[,] grid = new string [50,50]; ...might be this? will try to fill the string then print it...if that matters.... already tried filling the string and use it to fill the lblMap.Text...still it takes time to update the lblMap.text as I move..when I press a move button it takes a couple of seconds to move to the right place..the problem is the required map size is too immense..if I just use 15x15 ..it automatically updates and moves...any way I could fix this long wait to update? anything I could use besides the multidimensional string or brand?



Top
 Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  Page 1 of 1
 [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: yy_gexejefoha_yy and 0 guests


 
Search for:
 
Jump to:  

cron
Click me:
Powered by phpBB © 2000, 2002, 2005, 2007, 2008, 2009 phpBB Group
Chronicles phpBB3 theme by Jakob Persson. Stone textures by Patty Herford.
With special thanks to RuneVillage

This site have 4 type of tecnology in order to convert text to speech. By default you use the vozme tecnology. In order to know the other you need to sign for.


- Privacy Policy -