?? loginbar.cs
字號:
if(objControl.ID != "")
{
for(int j=0; j<base.Page.Controls[i].Controls.Count; j++)
{
objControl = (Control)base.Page.Controls[i].Controls[j];
if(objControl.ID == this.ID)
{
TextBox objTextBox;
objTextBox = (TextBox)base.Page.FindControl(this.ID + ":" + ID);
return objTextBox.Text;
}
}
}
}
return null;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad (e);
this.Version = base.Page.Request.Browser.MajorVersion;
if(base.Page.IsPostBack != false)
{
SetStruct();
SetControl();
}
}
protected override void Render(HtmlTextWriter objHtmlTextWriter)
{
this.EnsureChildControls();
base.Render(objHtmlTextWriter);
}
protected override void CreateChildControls()
{
Controls.Add(new LiteralControl("<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#d6dff7\">" + "\n"));
Controls.Add(new LiteralControl(" <tr class=\"LoginBar\">" + "\n"));
Controls.Add(_HtmlTableCell);
Controls.Add(new LiteralControl(" </tr>" + "\n"));
Controls.Add(new LiteralControl("</table>" + "\n"));
if(base.Page.IsPostBack != true)
{
SetStruct();
SetControl();
}
}
private void SetStruct()
{
this.ModeFilename.Default = this.Pathname + "Includes/LoginBar/Default.css";
this.ModeFilename.Office2003 = this.Pathname + "Includes/LoginBar/Office2003.css";
string strModeFilename = this.ModeFilename.Default;
if(this.Mode == LoginBarMode.Office2003) strModeFilename = this.ModeFilename.Office2003;
_HtmlTableCell.Controls.Add(new LiteralControl("<link href=\"" + strModeFilename + "\" type=\"text/css\" rel=\"stylesheet\">" + "\n"));
}
private void SetControl()
{
if(this.Version >= 6)
{
_HtmlTableCell.Controls.Add(new LiteralControl("<script language=\"javascript\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl("<!--" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" var _" + this.ID + "_Total = 0;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" var _" + this.ID + "_Opacity = 0;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" var _" + this.ID + "_Height = 0;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" var _" + this.ID + "_Velocity = " + this.Velocity + ";" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" " + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" function _" + this.ID + "_Initialize()" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.style.setAttribute(\"display\",\"block\")" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Total = _" + this.ID + "_Div.offsetHeight;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.style.setAttribute(\"display\",\"none\")" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" " + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" function _" + this.ID + "_Click()" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" if(_" + this.ID + "_Div.style.display == \"none\")" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.style.setAttribute(\"height\",\"0\");" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.style.setAttribute(\"display\",\"block\");" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Opacity = 0;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Height = 0;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Expand();" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Title.background = \"" + this.Expanded + "\";" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" else" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.style.setAttribute(\"height\",_" + this.ID + "_Total);" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Opacity = 100;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Height = _" + this.ID + "_Total;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Close();" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Title.background = \"" + this.Closed + "\";" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" " + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" function _" + this.ID + "_Expand()" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" if(_" + this.ID + "_Height <= (_" + this.ID + "_Total + 1) * (2 * _" + this.ID + "_Velocity - 1) / (2 * _" + this.ID + "_Velocity))" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Opacity = _" + this.ID + "_Opacity + 100 / (2 * _" + this.ID + "_Velocity);" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Height = _" + this.ID + "_Height + _" + this.ID + "_Total / (2 * _" + this.ID + "_Velocity);" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.style.setAttribute(\"height\",_" + this.ID + "_Height);" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.filters.alpha.opacity = _" + this.ID + "_Opacity;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" window.setTimeout(\"_" + this.ID + "_Expand()\",50);" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" else" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.style.setAttribute(\"height\",_" + this.ID + "_Total);" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" " + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" function _" + this.ID + "_Close()" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" if(_" + this.ID + "_Height >= (_" + this.ID + "_Total + 1) / _" + this.ID + "_Velocity)" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Opacity = _" + this.ID + "_Opacity - 100 / _" + this.ID + "_Velocity;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Height = _" + this.ID + "_Height - _" + this.ID + "_Total / _" + this.ID + "_Velocity;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.style.setAttribute(\"height\",_" + this.ID + "_Height);" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.filters.alpha.opacity = _" + this.ID + "_Opacity;" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" window.setTimeout(\"_" + this.ID + "_Close()\",50);" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" else" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" {" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" _" + this.ID + "_Div.style.setAttribute(\"display\",\"none\");" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" }" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl("-->" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl("</script>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl("<table align=\"center\" cellSpacing=\"4\" cellPadding=\"0\" width=\"320\" border=\"0\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <td vAlign=\"top\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <table width=\"100%\" height=\"25\" cellspacing=\"0\" cellpadding=\"0\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <td width=\"*\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <table cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" height=\"25\" border=\"1\" frame=\"below\" bordercolor=\"white\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <td> </td>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </table>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </td>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <td width=\"218\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <table width=\"100%\" height=\"25\" cellspacing=\"0\" cellpadding=\"0\" background=\"" + this.Closed + "\" id=\"_" + this.ID + "_Title\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <td width=\"12\"> </td>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <td class=\"LoginBar_Title\" onclick=\"_" + this.ID + "_Click();\">" + this.Title + "</td>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </table>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </td>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </table>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <div style=\"display:block; filter:alpha(opacity=100); overflow:hidden; position:relative\" id=\"_" + this.ID + "_Div\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <table width=\"100%\" cellspacing=\"4\" cellpadding=\"0\" class=\"LoginBar_Group\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <td>" + "\n"));
for(int i=0; i<_Items.Count; i++)
{
_HtmlTableCell.Controls.Add(new LiteralControl(" <table width=\"100%\" height=\"20\" cellspacing=\"0\" cellpadding=\"0\" class=\"Item\">" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <td width=\"30%\">" + _Items[i].Label + "</td>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" <td width=\"70%\">"));
TextBox objTextBox = new TextBox();
objTextBox.ID = _Items[i].ID;
objTextBox.Text = _Items[i].Text;
if(_Items[i].Type == "Password") objTextBox.TextMode = TextBoxMode.Password;
objTextBox.Style.Add("width","100%");
objTextBox.Attributes.Add("class","LoginBar_Text");
_HtmlTableCell.Controls.Add(objTextBox);
_HtmlTableCell.Controls.Add(new LiteralControl(" </td>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </tr>" + "\n"));
_HtmlTableCell.Controls.Add(new LiteralControl(" </table>" + "\n"));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -