Here's an example of how to display characters by casting a int
to a char
. If we do this in a loop (and for enough iterations), we will end up displaying all the characters. Unfortunately, I think there's over 100,000 Unicode characters, which is probably more than you want to display (and not all of them will display something for every font).
I'll leave it up to you to figure out which ones you really want to display, but here's a sample that prints out the first 3,750 (75 x 50) of them in a grid of buttons. *Note that the load time gets slower and slower with the more controls you add.
Just create a new WinForms project and put this code into the Form_Load
event. You can adjust the grid size (and therefore the load time) using the variables defined:
private void Form1_Load(object sender, EventArgs e)
{
int gridWidth = 75;
int gridHeight = 50;
int controlSize = 20;
int row = 0;
for (int i = 1; i < gridWidth * gridHeight; i++)
{
var value = ((char) i).ToString();
Controls.Add(new Button
{
Left = i % gridWidth * controlSize,
Top = row * controlSize,
Width = controlSize,
Height = controlSize,
Text = value
});
if (i % gridWidth == 0) row++;
}
}
Output
