91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 9KB
    文件類型: .cs
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-09
  • 語言: C#
  • 標簽:

資源簡介

web.net(C#)用戶自定義登陸控件

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Drawing;
using?System.ComponentModel;

namespace?Dealeasy.Web
{
????///?
????///?Button、重置Button以及承載以上四項的Panel。控件類名為LoginCtrl。
????///?(例程使用C#)
????///?

????[DefaultProperty(“BackColor“)ToolboxData(“<{0}:LoginCtrl?runat=server>“)]
????public?class?LoginCtrl?:?WebControl
????{
????????private?Color?_fontColor?=?Color.Black;//聲明字體顏色變量
????????private?Color?_backColor?=?Color.White;//聲明控件背景變量

????????//首先聲明要在復合控件中使用的子控件。
????????private?Label?lblUserName?=?new?Label();//顯示“用戶名”的Label控件
????????private?Label?lblPassWord?=?new?Label();//顯示“密碼”的Label控件
????????private?TextBox?txtUserName?=?new?TextBox();//用戶名輸入的TextBox控件
????????private?TextBox?txtPassWord?=?new?TextBox();//密碼輸入的TextBox控件
????????private?Button?submitButton?=?new?Button();//提交Button控件
????????private?Button?clearButton?=?new?Button();//重置Button控件
????????private?Panel?pnlframe?=?new?Panel();//承載其它控件的容器Panel控件

????????//當然要在符合控件中使用的事件一定要聲明的,它們會出現在屬性框的事件欄里。
????????public?event?EventHandler?Submitonclick;//聲明自定義控件LoginCtrl的提交事件
????????public?event?EventHandler?Clearonclick;//聲明自定義控件LoginCtrl的重置事件

????????///?
????????///?剛剛聲明的子控件和事件要在這里進行初始化處理。
????????///?

????????public?LoginCtrl()
????????{
????????????//初始化控件的屬性
????????????this.lblUserName.Text?=?“用戶名:“;
????????????this.lblPassWord.Text?=?“密??碼:“;
????????????txtPassWord.TextMode?=?TextBoxMode.Password;

????????????this.pnlframe.Width?=?240;
????????????this.pnlframe.Height?=?120;
????????????this.pnlframe.BackColor?=?Color.Empty;

????????????//添加提交按鈕點擊事件
????????????submitButton.Text?=?“確定“;
????????????submitButton.Click?+=?new?EventHandler(this.SubmitBtn_Click);

????????????//添加重置按鈕點擊事件
????????????clearButton.Text?=?“重置“;
????????????clearButton.Click?+=?new?EventHandler(this.ClearBtn_Click);

????????????//將聲明的各子控件添加到LoginCtrl中
????????????this.Controls.Add(this.submitButton);
????????????this.Controls.Add(this.clearButton);
????????????this.Controls.Add(this.txtUserName);
????????????this.Controls.Add(this.txtPassWord);
????????????this.Controls.Add(this.lblUserName);
????????????this.Controls.Add(this.lblPassWord);
????????????this.Controls.Add(this.pnlframe);
????????}

????????#region?根據自己的需要添加或重載符合控件的公共屬性
????????//字體顏色屬性
????????[Bindable(false)
?????????????Category(“Appearance“)
?????????????DefaultValue(““)]
????????public?override?Color?ForeColor
????????{
????????????get
????????????{
????????????????return?this._fontColor;
????????????}
????????????set
????????????{
????????????????this._fontColor?=?value;
????????????}
????????}
????????//控件背景屬性
????????[Bindable(false)
????????Category(“Appearance“)
????????DefaultValue(““)]
????????public?override?Color?BackColor
????????{
????????????get
????????????{
????????????????return?thi

評論

共有 條評論