关于如何能改变text的内容

来源:互联网 发布:mac win10 触摸板设置 编辑:程序博客网 时间:2024/05/16 09:49
public class fact
    {
       
private bool _Clicked;
       
public bool clicked
        {
           
get { return _Clicked; }
           
set
            {
                _Clicked
= value;}}private string _GetText;
       
public string getText
        {
           
get
            {

               
if (_Clicked)
                {
                    _GetText
= "回答正确";
                }
               
else
                {
                    _GetText
= "回答错误";
                }

               
return _GetText;
            }

        }
       
       
    }




 
C# code
public partial class Form3 : Form { BindingSource bindingSource1 = new BindingSource(); public Form3() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { fact _fact=new fact(); _fact.clicked=true; bindingSource1.Add(_fact); label1.DataBindings.Add("Text", bindingSource1, "getText"); } }
原创粉丝点击