如何更改用户控件按钮的文本 [英] How to change the text of an user control button

查看:68
本文介绍了如何更改用户控件按钮的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含按钮的用户控件.在这些按钮中,我想通过不同的langugageID更改不同语言的文本.代码如下:

I have a user control which comprise of a button. Of these button, I want to change the text in different language by different langugageID. Codes as follow:

public class MLButton : Button
   {

       public new string Text
       {
           get
           {
               if (this.DesignMode)
               {
                   return base.Text;
               }
               //To get different language  Text by LanguageID
               return LanguageManager.GetText(LanguageID);
           }
           set
           {
               base.Text = value;
           }
       }


       public AdminStrings LanguageID
       {
           get
           {
               return this.ViewState["LanguageID"];
           }

           set
           {
               this.ViewState["LanguageID"] = value;
           }



可能吗?请指导我.谢谢.



Is it possible? Please guide me .Thank you.

推荐答案

我更改了以下代码:
I changed the codes like that:
public class MLButton : Button
   {


       public AdminStrings LanguageID
       {
           get
           {
               return this.ViewState["LanguageID"];
           }

           set
           {
               this.ViewState["LanguageID"] = value;
              //To get different language  Text by LanguageID
               this.text=return LanguageManager.GetText(LanguageID);

           }


}

然后,按钮可以获取正确的语言文本,但我也不知道那是怎么发生的.如果您知道,请告诉我,谢谢.


}

and then,buttons can get right language text,but I also don''t know how that happened. If you konw,please tell me ,thank you.


这篇关于如何更改用户控件按钮的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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