So I'm trying to create a label with the following code :
Label letter = new Label();
String key = Convert.ToString(e.KeyChar);
letter.Text = key;
letter.ForeColor = textColor;
letter.Size = new Size(10, 20);
letterSpacing = letterSpacing + letter.Size.Width;
letter.Location = new Point(letterSpacing, (line * 18));
type.Controls.Add(letter);
letters.Add(letter); //this is a List<> of controls.
But I would also like to change the "letter" label to have the highest "z-index" or to bring it to the front of all other controls. I know that you can do this threw visual studios by right-clicking and selecting "bring to front", but is there a way to do this threw code? I also looked into the Canvas.SetZIndex
method, however visual studios still throws and exception when I try this.