alStatus
asked on
How would you change the font color during run time in C#?
maze[xEntrance, 0] = "S";
maze[xEntrance, 1] = "M"; //<---- how t0 change this "M" into another color?
maze[xEntrance, 2] = " ";
maze[left, 1] = " ";
maze[xEntrance, 1] = "M"; //<---- how t0 change this "M" into another color?
maze[xEntrance, 2] = " ";
maze[left, 1] = " ";
Pretty sure "maze" was just a String Array right? It doesn't have a color associated with it; simply a value. The coloring would be done by the CONTROL you use to display the values. If you are using a Label then everything is the same color. To get multiple colors you could display everything in a RichTextBox which allows you to include multiple formats and colors all in the same control.
Will all like values in the maze be the same color? If not, then you'll need to associate a color with each cell in the maze which means you'd need an addition array or possibly store a class in the array instead of a straight string value.
ASKER
Yep, its a string array. When the "M" moves in the array, id like the "M" be a different color then the Maze array. And The "F" be a different color, to symbol the foot print left behind. So go with the RichTextBox?
Definitely RichTextbox as that would be the easiest. It's either that, or use separate Labels or TextBoxes for each cell in the maze.
If you post your current method that generates the output I can help you convert to the RichTextbox.
If you post your current method that generates the output I can help you convert to the RichTextbox.
ASKER
Not sure which function so added all functions.
MickyMouseMaze.zip
MickyMouseMaze.zip
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great example! But, it does not print the right boarder on the maze is it because of one of the property options, like it was for the label?
All elements should be printed just as before. Most likely you just need to make the RichTextBox WIDER... =)
ASKER
Yep, had the RichTextBox size = to 1303,729.
ASKER
I changed the text to courier new, that worked.
ASKER
Great demo, thanks man!