点击linklabel c#添加文本框 [英] add textbox by click on linklabel c#

查看:47
本文介绍了点击linklabel c#添加文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表单c#里面有一个linkLabel,并且已经创建了一个文本框,但它是不可见的,我想在我点击linkLabel时使文本框可见

我该怎么办?这个?

I have a linkLabel inside a form c#, and there is a textbox created already ,but it is invisible,i want to make the textbox visible when i click on the linkLabel
how can i do this?

推荐答案

首先,在Visual Studio表单设计器中,双击 LinkLabel 。现在,创建了 LinkClicked 方法的事件处理程序,现在,您可以编辑 yourLinkLabel_LinkClicked 方法的代码:

First, in the Visual Studio Form Designer, double-click on the LinkLabel. Now, an event handler to the LinkClicked method is created, and now, you can edit the code of the yourLinkLabel_LinkClicked method:
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
    yourTextBox.Visible = true;
}









如果你想要单击第二次使文本框不可见时,请尝试:





If you want to make the text box invisible when clicking a second time, try this:

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
    yourTextBox.Visible = !yourTextBox.Visible;
}


这篇关于点击linklabel c#添加文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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