8.4.txt

来自「《Microsoft Visual C# .NET 2003开发技巧大全》源代码」· 文本 代码 · 共 31 行

TXT
31
字号
Listing 8.4 Examining Radio Button Checked State
private void UpdateLabels()
{
// enumerate each control in the control container (GroupBox)
foreach( Control ctrl in groupColor.Controls )
{
// determine if radio button
if( ctrl.GetType() == typeof(RadioButton) )
{
// cast control to RadioButton object
RadioButton radio = (RadioButton) ctrl;
if( radio.Checked == true )
{
labelColor.Text = “Color: “ + radio.Text;
break;
}
}
}
foreach( Control ctrl in groupSize.Controls )
{
if( ctrl.GetType() == typeof(RadioButton) )
{
RadioButton radio = (RadioButton) ctrl;
if( radio.Checked == true )
{
labelSize.Text = “Size: “ + radio.Text;
break;
}
}
}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?