• 铵钮的文本换行显示


    看看下动画效果:

    C#有一个类System.Environment,它有一个NewLine静态Get属性,即可实现换行。

    OK,知道有这个功能后,我们就可以文本换行了,我们在Default.aspx放一个按钮,参考下第12行。

    View Code
     1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
     2 
     3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     4 
     5 <html xmlns="http://www.w3.org/1999/xhtml">
     6 <head runat="server">
     7     <title></title>
     8 </head>
     9 <body>
    10     <form id="form1" runat="server">
    11     <div>
    12         <asp:Button ID="Button1" runat="server" Text="" />       
    13     </div>
    14     </form>
    15 </body>
    16 </html>

    然后在cs写:

    View Code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public partial class _Default : System.Web.UI.Page
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.Button1.Text = "Hi,Insus.NET," + Environment.NewLine + "请用Mouse点击我";
            this.Button1.Click +=Button1_Click;
        }
        
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        private void Button1_Click(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "this""<script>alert('看看,按钮的Text换行显示。');</script>");
        }
    }

    下面补充于2012-11-01 20:29,可以用此方法实现垂直铵钮。


     

  • 相关阅读:
    第二篇第十一章灭火救援设施
    第二篇第六章安全疏散
    第二篇第五章防火防烟分区于分隔
    第二篇第三章建筑分类与耐火等级
    applicationContext-solr.xml
    solrj 操作 solr 集群版
    centos solr 集群搭建
    org.apache.ibatis.binding.BindingException
    全文检索基础
    solrj 操作 solr 单机版
  • 原文地址:https://www.cnblogs.com/insus/p/2736426.html
Copyright © 2020-2023  润新知