Home > Net >  In c # attribute set multi-level control
In c # attribute set multi-level control

Time:09-24

In a form of multi-level multiple textbox set properties, will be readonly set to true: what happened? Pray god give directions

CodePudding user response:

It's a very simple with WPF

CodePudding user response:

You'd say, what is a multi-level?

 
TextBox text=new TextBox ();
Foreach (var in this. O Controls)
{
If (o.G etType ()==typeof (TextBox))
{
Text=(TextBox) o;
The text. The ReadOnly=true;

}
}

CodePudding user response:

Multi-level because using the pannel and groupbox control, so there is no way to one-time change properties

CodePudding user response:

As long as you have selected controls readonly attribute, then you can choose more, then one-time change properties, on the change properties of the place, if you have a not readonly attribute in the selected controls, it can't

CodePudding user response:

I don't know how to select different levels of all controls

CodePudding user response:


 
TextBox text=new TextBox ();
Void ChangePropertyToReadOnly Control (col)
{
Foreach (cols in col. Controls)
{
If (cols. GetType ()==typeof (TextBox))
{
Text=(TextBox) cols.
The text. The ReadOnly=true;
}

ChangePropertyToReadOnly (cols);

}
}


  •  Tags:  
  • C #
  • Related