zoukankan      html  css  js  c++  java
  • 铵钮的文本换行显示

    看看下动画效果:

    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,可以用此方法实现垂直铵钮。


     

  • 相关阅读:
    python 连接操作mysql数据库
    (转)postfix疯狂外发垃圾邮件之分析与解决
    ansible 常用方法
    用python2.7.9 写个小程序搜索某个目录下行有某关键字
    python获取文件扩展名的方法(转)
    ceph 池管理
    UVALive 5412 Street Directions
    UVALive 3231 Fair Share
    UVA 11478 Halum
    2015 Multi-University Training Contest 4 hdu 5338 ZZX and Permutations
  • 原文地址:https://www.cnblogs.com/insus/p/2736426.html
Copyright © 2011-2022 走看看