C# 设置panel的透明度
1、直接上代码静态文件代码:
<asp:Panel runat="server" ID="touming1" style="color:Red;opacity:0.1;font-size:40px">透明度</asp:Panel> <br />
<asp:Panel runat="server" ID="touming2" style="color:Red;opacity:0.2;font-size:40px">透明度</asp:Panel> <br />
<asp:Panel runat="server" ID="touming3" style="color:Red;opacity:0.3;font-size:40px">透明度</asp:Panel> <br />
<asp:Panel runat="server" ID="touming4" style="color:Red;opacity:0.5;font-size:40px">透明度</asp:Panel> <br />
<asp:Panel runat="server" ID="touming5" style="color:Red;opacity:0.7;font-size:40px">透明度</asp:Panel> <br />
<asp:Panel runat="server" ID="touming6" style="color:Red;opacity:1;font-size:40px">透明度</asp:Panel> <br />
2、 方法一
this.touming1.Style.Add("opacity", "0.9");
this.touming2.Style.Add("opacity", "0.1");
this.touming3.Style.Add("opacity", "0.4");
this.touming4.Style.Add("opacity", "0.1");
this.touming5.Style.Add("opacity", "0.5");
this.touming6.Style.Add("opacity", "0.7");
3、 方法二
this.touming2.Attributes.Add("style", "opacity:0.6;font-size:40px;color:Red;");