我试图隐藏我的btnReset按钮,直到点击btnOne。这可能吗? [英] Im trying to hide my btnReset button until btnOne is clicked. Is this possible?

查看:135
本文介绍了我试图隐藏我的btnReset按钮,直到点击btnOne。这可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用System;

使用System.Collections.Generic;

使用System.ComponentModel;

使用System.Data;

使用System.Drawing;

使用System.Linq;

使用System.Text;

使用System.Windows.Forms ;



名称空间WindowsFormsApplication1

{

公共部分类Form1:表格

{

public Form1()

{

InitializeComponent();



}







private void btnOne_Click(object sender,EventArgs e)

{



txtBoxTwo.Text =你好!;



}



private void btnTwo_Click(object sender,EventArgs e)

{



txtBoxTwo.Text =你好! ++ txtBoxOne.Text;

txtBoxOne.Text =;

}



private void btnReset_Click(对象发送者,EventArgs e)

{



txtBoxOne.Text =;

txtBoxTwo。 Text =;

}



private void txtBoxOne_TextChanged(object sender,EventArgs e)

{









}

}

}

解决方案

这是用于控制可见性的属性: Control.Visible Property(System.Windows.Forms) [ ^ ] 。



看起来你已经知道怎么做了点击按钮。如果您需要处理其他一些事件,例如按下按钮(它不是100%清除您想要达到的目标),请澄清。



- SA

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

}



private void btnOne_Click(object sender, EventArgs e)
{

txtBoxTwo.Text = "Hello!";

}

private void btnTwo_Click(object sender, EventArgs e)
{

txtBoxTwo.Text = "Hello!" + " " + txtBoxOne.Text;
txtBoxOne.Text = "";
}

private void btnReset_Click(object sender, EventArgs e)
{

txtBoxOne.Text = "";
txtBoxTwo.Text = "";
}

private void txtBoxOne_TextChanged(object sender, EventArgs e)
{




}
}
}

解决方案

This is the property you use to control visibility: Control.Visible Property (System.Windows.Forms)[^].

It looks like you already know how to handle button clicks. If you need to handle some other events, such as depressing a button (it's not 100% clear what you want to achieve), please clarify.

—SA


这篇关于我试图隐藏我的btnReset按钮,直到点击btnOne。这可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆