Answer the question
In order to leave comments, you need to log in
Label is not added through the code, what's the problem?
There is a class Syntax which describes a function that returns an object of type Label with characteristics (location, size, font, etc.). In the main file, in the function that describes the actions, this function is called every time the code changes, which is equal to the local Label. The label itself does not appear no matter how you change it.
Function call:
//...
Label syntaxLabel = Syntax.AddLabelOnText();
syntaxLabel.AccessibleName = "syntaxLabel";
Controls.Add(syntaxLabel);
public Label AddLabelOnText()
{
Label syntaxLabel = new Label();
syntaxLabel.Text = "aaa";
syntaxLabel.ForeColor = Color.White;
syntaxLabel.Location = new Point(560, 13);
syntaxLabel.BorderStyle = BorderStyle.Fixed3D;
syntaxLabel.UseMnemonic = true;
syntaxLabel.Size = new Size(10, 10);
syntaxLabel.AccessibleName = "syntaxLabel";
syntaxLabel.Visible = true;
return syntaxLabel;
}
Label labela = new Label()
{
Text = "First Name",
Location = new Point(100, 100),
TabIndex = 10
};
Controls.Add(labela);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question