I have a Boolean control_refresh in class A and in a class that inheres A i have a function in which is control_refresh=true;. The code compiles fine.
file_1.cs
public partial class graficki_editor : Form
{
...
internal bool control_refresh = false;
...
}
file_3.cs
public partial class graficki_editor : Form
{
...
private void canvas_paint(object sender, PaintEventArgs e)
{
debug_label.Text = control_refresh.ToString();
}
...
}
file_2.cs
internal class projekt : graficki_editor
{
...
private void sloj_Checked(object sender, EventArgs e)
{
if (((CheckBox)sender).Checked)
objekti.ElementAt(pan.Controls.IndexOf(((CheckBox)sender).Parent)).visible = true;
else objekti.ElementAt(pan.Controls.IndexOf(((CheckBox)sender).Parent)).visible = false;
control_refresh = true;
canvas.Refresh();
}
....
}
(Non relevant code is excluded)
In the scope of sloj_Checked I can set control_refresh and in than scope it works fine. But when the control is refreshed and paint event is called the variable stays the same.
My question is how do I change the variable?
Aucun commentaire:
Enregistrer un commentaire