(1)Style属性
         private void btnUpload_Click(object sender, System.EventArgs e)
      {
            Label1.Style("text-transform") = "Capitalize";      
        }

(2)cssClass属性
           <html>
                <head>
                    <style>
                            .myClass1
                                {
                                    font:18pt script;
                                    color: red;
                                 }
                           .myClass2
                                {
                                    font:24pt script;
                                    color: blue;
                                 }
                    </style>
                </head>
                    ……
                    ……
           </html>
         private void btnUpload_Click(object sender, System.EventArgs e)
      {
            Label1.cssClass ="myClass2";
        }

(3)生成Style类并赋给控件

动态改变控件的样式(Css)        private void Button1_Click(object sender, System.EventArgs e)
        }

ApplyStyle()方法覆盖了控件的旧样式,而MergeStyle()则不会覆盖现存的属性。
   

相关文章:

  • 2022-01-03
  • 2022-12-23
  • 2021-12-04
  • 2022-03-07
  • 2022-12-23
  • 2021-12-05
  • 2021-12-05
猜你喜欢
  • 2022-01-12
  • 2021-12-05
  • 2021-05-25
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案