当前位置: 首页>>代码示例>>C#>>正文


C# TextBox.ApplyStyle方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.TextBox.ApplyStyle方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.ApplyStyle方法的具体用法?C# TextBox.ApplyStyle怎么用?C# TextBox.ApplyStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.TextBox的用法示例。


在下文中一共展示了TextBox.ApplyStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateControlHierarchy


//.........这里部分代码省略.........
            Style s2 = new Style();
            s2.Width = guidWidth;
            s2.ForeColor = BorderColor;

            Style s3 = new Style();
            s3.Width = buttonColumnWidth;
            s3.ForeColor = ForeColor;
            Style s4 = new Style();
            s4.Width = dataWidth;

            Style txtAreaStyle = new Style();
            //txtAreaStyle.Height = txtBoxHeight;
            txtAreaStyle.Width = dataWidth;
            txtAreaStyle.BorderColor = BorderColor;

            Style txtBoxStyle = new Style();
            txtBoxStyle.Height = txtBoxHeight;
            txtBoxStyle.Width = dataWidth;
            txtBoxStyle.BorderColor = BorderColor;

            Style txtGuidStyle = new Style();
            txtGuidStyle.Height = txtBoxHeight;
            txtGuidStyle.Width = guidWidth;
            txtGuidStyle.BorderColor = BorderColor;

            TableRow row;
            TableHeaderCell th;
            TableCell td;
            TableCell td2;
            //Label lbl;
            //Create the first row
            row = new TableRow();
            th = new TableHeaderCell();
            th.ApplyStyle(s1);
            td = new TableCell();
            td.ApplyStyle(s2);
            td2 = new TableCell();
            td2.ApplyStyle(s3);
            row.Cells.Add(th);
            row.Cells.Add(td);
            row.Cells.Add(td2);
            tblMain.Rows.Add(row);

            row = new TableRow();
            th = new TableHeaderCell();
            th.ColumnSpan = 3;
            th.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            th.Text = "Required Credential Information";
            row.Cells.Add(th);
            tblMain.Rows.Add(row);

            row = new TableRow();
            th = new TableHeaderCell();
            lblServiceName = new Label();
            lblServiceName.ID = "lblServiceName";
            lblServiceName.Text = "Service Name";
            th.Controls.Add(lblServiceName);
            td = new TableCell();
            td.ColumnSpan = 2;
            txtServiceName = new TextBox();
            txtServiceName.ID = "txtServiceName";
            txtServiceName.ApplyStyle(txtBoxStyle);
            txtServiceName.Text = AgentName;
            td.Controls.Add(txtServiceName);
            row.Cells.Add(th);
            row.Cells.Add(td);
开发者ID:tordf,项目名称:iLabs,代码行数:67,代码来源:RegisterSelf.cs

示例2: InstantiateIn

			public void InstantiateIn (Control container)
			{
				Table table = new Table ();
				table.CellPadding = 0;

				bool twoCells = _owner.TextLayout == LoginTextLayout.TextOnLeft;

				// row 0
				table.Rows.Add (
					TemplateUtils.CreateRow (new LiteralControl (_owner.QuestionTitleText), null, _owner.TitleTextStyle, null, twoCells));

				// row 1
				table.Rows.Add (
					TemplateUtils.CreateRow (new LiteralControl (_owner.QuestionInstructionText), null, _owner.InstructionTextStyle, null, twoCells));

				// row 2
				Literal UserNameLiteral = new Literal ();
				UserNameLiteral.ID = "UserName";

				table.Rows.Add (
					TemplateUtils.CreateRow (new LiteralControl (_owner.UserNameLabelText), UserNameLiteral, _owner.LabelStyle, _owner.LabelStyle, twoCells));

				// row 3
				Literal QuestionLiteral = new Literal ();
				QuestionLiteral.ID = "Question";

				table.Rows.Add (
					TemplateUtils.CreateRow (new LiteralControl (_owner.QuestionLabelText), QuestionLiteral, _owner.LabelStyle, _owner.LabelStyle, twoCells));

				// row 5
				TextBox AnswerTextBox = new TextBox ();
				AnswerTextBox.ID = "Answer";
				AnswerTextBox.ApplyStyle (_owner.TextBoxStyle);

				Label AnswerLabel = new Label ();
				AnswerLabel.ID = "AnswerLabel";
				AnswerLabel.AssociatedControlID = "Answer";
				AnswerLabel.Text = _owner.AnswerLabelText;
				AnswerLabel.ApplyStyle (_owner.LabelStyle);

				RequiredFieldValidator AnswerRequired = new RequiredFieldValidator ();
				AnswerRequired.ID = "AnswerRequired";
				AnswerRequired.ControlToValidate = "Answer";
				AnswerRequired.ErrorMessage = _owner.AnswerRequiredErrorMessage;
				AnswerRequired.ToolTip = _owner.AnswerRequiredErrorMessage;
				AnswerRequired.Text = "*";
				AnswerRequired.ValidationGroup = _owner.ID;
				AnswerRequired.ApplyStyle (_owner.ValidatorTextStyle);

				if (twoCells) {
					TableRow row = TemplateUtils.CreateRow (AnswerLabel, AnswerTextBox, null, null, twoCells);
					row.Cells [1].Controls.Add (AnswerRequired);
					table.Rows.Add (row);
				}
				else {
					table.Rows.Add (TemplateUtils.CreateRow (AnswerLabel, null, null, null, twoCells));
					TableRow row = TemplateUtils.CreateRow (AnswerTextBox, null, null, null, twoCells);
					row.Cells [0].Controls.Add (AnswerRequired);
					table.Rows.Add (row);
				}

				// row 6
				Literal FailureText = new Literal ();
				FailureText.ID = "FailureText";
				if (_owner.FailureTextStyle.ForeColor.IsEmpty)
					_owner.FailureTextStyle.ForeColor = System.Drawing.Color.Red;
				table.Rows.Add (TemplateUtils.CreateRow (FailureText, null, _owner.FailureTextStyle, null, twoCells));

				// row 7
				WebControl SubmitButton = null;
				switch (_owner.SubmitButtonType) {
					case ButtonType.Button:
						SubmitButton = new Button ();
						break;
					case ButtonType.Image:
						SubmitButton = new ImageButton ();
						break;
					case ButtonType.Link:
						SubmitButton = new LinkButton ();
						break;
				}

				SubmitButton.ID = "SubmitButton";
				SubmitButton.ApplyStyle (_owner.SubmitButtonStyle);
				((IButtonControl) SubmitButton).CommandName = PasswordRecovery.SubmitButtonCommandName;
				((IButtonControl) SubmitButton).Text = _owner.SubmitButtonText;
				((IButtonControl) SubmitButton).ValidationGroup = _owner.ID;

				TableRow buttonRow = TemplateUtils.CreateRow (SubmitButton, null, null, null, twoCells);
				buttonRow.Cells [0].HorizontalAlign = HorizontalAlign.Right;
				table.Rows.Add (buttonRow);

				// row 8
				table.Rows.Add (
					TemplateUtils.CreateHelpRow (
					_owner.HelpPageUrl, _owner.HelpPageText, _owner.HelpPageIconUrl, _owner.HyperLinkStyle, twoCells));

				container.Controls.Add (table);
			}
开发者ID:Profit0004,项目名称:mono,代码行数:99,代码来源:PasswordRecovery.cs

示例3: InstantiateIn

			public void InstantiateIn (Control container)
			{
				Table table = new Table ();
				table.CellPadding = 0;

				// Row #0
				table.Controls.Add (
					CreateRow (new LiteralControl (_owner.ChangePasswordTitleText),
					null, null, _owner.TitleTextStyle, null));

				// Row #1
				if (_owner.InstructionText.Length > 0) {
					table.Controls.Add (
						CreateRow (new LiteralControl (_owner.InstructionText),
						null, null, _owner.InstructionTextStyle, null));
				}

				// Row #2
				if (_owner.DisplayUserName) {
					TextBox UserName = new TextBox ();
					UserName.ID = "UserName";
					UserName.Text = _owner.UserName;
					UserName.ApplyStyle (_owner.TextBoxStyle);

					Label UserNameLabel = new Label ();
					UserNameLabel.ID = "UserNameLabel";
					UserNameLabel.AssociatedControlID = "UserName";
					UserNameLabel.Text = _owner.UserNameLabelText;

					RequiredFieldValidator UserNameRequired = new RequiredFieldValidator ();
					UserNameRequired.ID = "UserNameRequired";
					UserNameRequired.ControlToValidate = "UserName";
					UserNameRequired.ErrorMessage = _owner.UserNameRequiredErrorMessage;
					UserNameRequired.ToolTip = _owner.UserNameRequiredErrorMessage;
					UserNameRequired.Text = "*";
					UserNameRequired.ValidationGroup = _owner.ID;
					UserNameRequired.ApplyStyle (_owner.ValidatorTextStyle);

					table.Controls.Add (CreateRow (UserNameLabel, UserName, UserNameRequired, _owner.LabelStyle, null));
				}

				// Row #3
				TextBox CurrentPassword = new TextBox ();
				CurrentPassword.ID = "CurrentPassword";
				CurrentPassword.TextMode = TextBoxMode.Password;
				CurrentPassword.ApplyStyle (_owner.TextBoxStyle);

				Label CurrentPasswordLabel = new Label ();
				CurrentPasswordLabel.ID = "CurrentPasswordLabel";
				CurrentPasswordLabel.AssociatedControlID = "CurrentPasswordLabel";
				CurrentPasswordLabel.Text = _owner.PasswordLabelText;

				RequiredFieldValidator CurrentPasswordRequired = new RequiredFieldValidator ();
				CurrentPasswordRequired.ID = "CurrentPasswordRequired";
				CurrentPasswordRequired.ControlToValidate = "CurrentPassword";
				CurrentPasswordRequired.ErrorMessage = _owner.PasswordRequiredErrorMessage;
				CurrentPasswordRequired.ToolTip = _owner.PasswordRequiredErrorMessage;
				CurrentPasswordRequired.Text = "*";
				CurrentPasswordRequired.ValidationGroup = _owner.ID;
				CurrentPasswordRequired.ApplyStyle (_owner.ValidatorTextStyle);

				table.Controls.Add (CreateRow (CurrentPasswordLabel, CurrentPassword, CurrentPasswordRequired, _owner.LabelStyle, null));

				// Row #4
				TextBox NewPassword = new TextBox ();
				NewPassword.ID = "NewPassword";
				NewPassword.TextMode = TextBoxMode.Password;
				NewPassword.ApplyStyle (_owner.TextBoxStyle);

				Label NewPasswordLabel = new Label ();
				NewPasswordLabel.ID = "NewPasswordLabel";
				NewPasswordLabel.AssociatedControlID = "NewPassword";
				NewPasswordLabel.Text = _owner.NewPasswordLabelText;

				RequiredFieldValidator NewPasswordRequired = new RequiredFieldValidator ();
				NewPasswordRequired.ID = "NewPasswordRequired";
				NewPasswordRequired.ControlToValidate = "NewPassword";
				NewPasswordRequired.ErrorMessage = _owner.PasswordRequiredErrorMessage;
				NewPasswordRequired.ToolTip = _owner.PasswordRequiredErrorMessage;
				NewPasswordRequired.Text = "*";
				NewPasswordRequired.ValidationGroup = _owner.ID;
				NewPasswordRequired.ApplyStyle (_owner.ValidatorTextStyle);

				table.Controls.Add (CreateRow (NewPasswordLabel, NewPassword, NewPasswordRequired, _owner.LabelStyle, null));

				// Row #5
				if (_owner.PasswordHintText.Length > 0) {
					table.Controls.Add (
						CreateRow (new LiteralControl (""),
							new LiteralControl (_owner.PasswordHintText),
							new LiteralControl (""),
							null, _owner.PasswordHintStyle));
				}

				// Row #6
				TextBox ConfirmNewPassword = new TextBox ();
				ConfirmNewPassword.ID = "ConfirmNewPassword";
				ConfirmNewPassword.TextMode = TextBoxMode.Password;
				ConfirmNewPassword.ApplyStyle (_owner.TextBoxStyle);

//.........这里部分代码省略.........
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:101,代码来源:ChangePassword.cs

示例4: Render

        protected override void Render(HtmlTextWriter writer)
        {
#if !V2
            bool DesignMode = this.Context == null;
#endif
            if (!DesignMode)
            {
                Anthem.Manager.WriteBeginControlMarker(writer, "span", this);
            }
            if (Visible)
            {
                if (!DesignMode && _showTextbox)
                {
                    // Non-IE browsers get a textbox for editing.
                    ASP.TextBox textbox = new ASP.TextBox();
                    textbox.ID = this.ClientID;
                    textbox.Text = Text;
                    textbox.ApplyStyle(GetStyle());
#if V2
                    textbox.EnableTheming = this.EnableTheming;
#endif
                    textbox.Attributes["onblur"] = string.Format("editLabelSave(this,{0},'{1}','{2}','{3}',{4},{5},{6},{7});",
                        "false",
                        string.Empty,
                        string.Empty,
                        this.TextDuringCallBack,
                        this.EnabledDuringCallBack ? "true" : "false",
                        this.PreCallBackFunction == null || this.PreCallBackFunction.Length == 0 ? "null" : this.PreCallBackFunction,
                        this.PostCallBackFunction == null || this.PostCallBackFunction.Length == 0 ? "null" : this.PostCallBackFunction,
                        this.CallBackCancelledFunction == null || this.CallBackCancelledFunction.Length == 0 ? "null" : this.CallBackCancelledFunction
                    );
                    textbox.Attributes["onkeypress"] = "return editLabelCheckKey(event);";
                    textbox.RenderControl(writer);
                }
                else
                {
                    base.Render(writer);
                }
            }
            if (!DesignMode)
            {
                Anthem.Manager.WriteEndControlMarker(writer, "span", this);
            }
        }
开发者ID:BackupTheBerlios,项目名称:ogen-svn,代码行数:44,代码来源:EditLabel.cs


注:本文中的System.Web.UI.WebControls.TextBox.ApplyStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。