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


     

  • 相关阅读:
    分享图片到在线服务
    获取和保存照片
    处理图片(updated)
    简化版“询问用户是否退出”
    捕获高像素照片(updated)
    处理高像素的照片
    加强版照片捕获
    图片拍摄、处理、镜头应用
    Windows Phone 推送通知的第四类推送
    网络通信
  • 原文地址:https://www.cnblogs.com/insus/p/2736426.html
Copyright © 2011-2022 走看看