このコードを使用して、すべてのテキスト ボックスを同じフォントにしています。
if (textBox1.Font.Underline)
{
foreach (Control y in this.Controls)
{
if (y is TextBox)
{
((TextBox)(y)).Font = new Font(((TextBox)(y)).Font, FontStyle.Regular);
}
}
}
else
{
foreach (Control y in this.Controls)
{
if (y is TextBox)
{
((TextBox)(y)).Font = new Font(((TextBox)(y)).Font, FontStyle.Underline);
}
}
太字のボタンをクリックするとしましょう。テキストが太字になります。下線ボタンをクリックすると、テキストは太字で下線が引かれるはずですが、下線だけですか??? なぜ?