0

私はWindowsフォームアプリケーションに取り組んでおり、ボタンとボタンがありますtextbox

ボタンを押すと、textbox表示と非表示が表示されます。

4

5 に答える 5

9
myTextbox.Visible = !myTextbox.Visible;
于 2013-01-10T02:49:58.947 に答える
4

Googleを試しましたか?

textBox1.Visible = false;

次の手順で表示を切り替えることができます。

if(textBox1.Visible == true)
    textBox1.Visible = false;
else
    textBox1.Visible = true;
于 2013-01-10T02:50:38.813 に答える
3

WinForm:

private void button1_Click(object sender, System.EventArgs e)
{
    textBox.Visible = !textBox.Visible;
}

WPF:

private void button1_Click(object sender, RoutedEventArgs e)
{
        if (textBox.Visibility != System.Windows.Visibility.Hidden)
            textBox.Visibility = System.Windows.Visibility.Hidden;
        else
            textBox.Visibility = System.Windows.Visibility.Visible;
}
于 2013-01-10T02:54:40.310 に答える
1

ここに例があります

private void button1_Click(object sender, System.EventArgs e)
{
   /* If the CTRL key is pressed when the 
      * control is clicked, hide the control. */ 
   if(Control.ModifierKeys == Keys.Control)
   {
      ((Control)sender).Hide();
   }
}
于 2013-01-10T02:50:07.873 に答える
1
textbox.visible=true;

ボタンクリックイベントでこれを試してください

于 2014-12-15T21:33:05.107 に答える