?? 在代碼中創建控件并使用.txt
字號:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace Co_5
{
/// <summary>
/// WebForm2 的摘要說明。
/// </summary>
public class WebForm2 : System.Web.UI.Page
{
public Label TopBarTitle;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此處放置用戶代碼以初始化頁面
if(!Page.IsPostBack)
{
TopBarTitle.Text="This is my Page.";
}
}
#region Web 窗體設計器生成的代碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 該調用是 ASP.NET Web 窗體設計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.Init += new System.EventHandler(this.WebForm2_Init);
}
#endregion
private void WebForm2_Init(object sender, System.EventArgs e)
{
//初始化頁時激發(先于Page_Load)
Controls.AddAt(0,new LiteralControl("<h2>"));
TopBarTitle=new Label();
TopBarTitle.Text="Top bar title";
Controls.AddAt(1,TopBarTitle);
Controls.AddAt(2,new LiteralControl("<h2>"));
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -