Lets say the text is a grid of 40 by 5 of the period character, which would give it a look like this:
........................................
........................................
........................................
........................................
........................................
And I then had an @ symbol in the middle like so:
........................................
........................................
..................@.....................
........................................
........................................
And when you press the up/down/left/right keys, the symbol moved without the confines of the grid.
This all works fine, but sometimes even when it's just a single key press, resetting the text in the box makes it flicker.
The way I do it at the moment is I render the grid into a string, and check every 100ms if the text is different to that rendered, and if it is, set the text to the new text.
But even when this is a single update, the textbox may flicker.
The code is:
private string RenderOutput()
{
string output = "";
for (int y = 0; y < mapSize.Height; y++)
{
for (int x = 0; x < mapSize.Width; x++)
{
if (x == point.X && y == point.Y) output += "@";
else output += ".";
}
output += "\n";
}
return output;
}
private void DrawOutput()
{
string output = RenderOutput();
if (rtf1.Text.ToString() != output)
{
rtf1.Text = output;
}
}
Application.DoEvents() has no effect, and I can't really think of anything else that would have, other than scrapping the text box idea all together, if I could find a rich text label..
Any ideas?

New Topic/Question
Reply




MultiQuote






|