本文整理汇总了C#中TextBox类的典型用法代码示例。如果您正苦于以下问题:C# TextBox类的具体用法?C# TextBox怎么用?C# TextBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextBox类属于命名空间,在下文中一共展示了TextBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstructionsForm
public InstructionsForm ()
{
//
// _tabControl
//
_tabControl = new TabControl ();
_tabControl.Dock = DockStyle.Fill;
Controls.Add (_tabControl);
//
// _bugDescriptionText1
//
_bugDescriptionText1 = new TextBox ();
_bugDescriptionText1.Multiline = true;
_bugDescriptionText1.Location = new Point (8, 8);
_bugDescriptionText1.Dock = DockStyle.Fill;
_bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture,
"Expected result on start-up:{0}{0}" +
"1. The background color of the Form is blue and does not show " +
"any distortions.",
Environment.NewLine);
//
// _tabPage1
//
_tabPage1 = new TabPage ();
_tabPage1.Text = "#1";
_tabPage1.Controls.Add (_bugDescriptionText1);
_tabControl.Controls.Add (_tabPage1);
//
// InstructionsForm
//
ClientSize = new Size (330, 120);
Location = new Point (600, 100);
StartPosition = FormStartPosition.Manual;
Text = "Instructions - bug #81721";
}
示例2: Interact
public Interact(string title)
{
Control.CheckForIllegalCrossThreadCalls = true;
Poke = new Button();
Poke.Text = "Poke";
this.Controls.Add(Poke);
Poke.Click += new EventHandler(Input);
//The adaptee includes specific details like this
//for the user interface
SendGift = new Button();
SendGift.Text = "Send Gift";
SendGift.Location = new Point(80, 0);
this.Controls.Add(SendGift);
SendGift.Click += new EventHandler(Input2);
GiftText = new TextBox();
GiftText.Location = new Point(160, 0);
this.Controls.Add(GiftText);
//*******************************************
Wall = new TextBox();
Wall.Multiline = true;
Wall.Location = new Point(0, 30);
Wall.Width = 300;
Wall.Height = 200;
Wall.Font = new Font(Wall.Font.Name, 12);
Wall.AcceptsReturn = true;
this.Text = title;
this.Controls.Add(Wall);
}
示例3: btnAttendance_Click
//protected void chkFullance_CheckedChanged(object sender, EventArgs e)
//{
// if (chkFullance.Checked)
// {
// foreach (GridViewRow gvr in dgrid.Rows)
// {
// Label lblStudID = new Label();
// lblStudID = (Label)gvr.Cells[0].FindControl("lblStaffID");
// DataSet ds1 = new DataSet();
// int month = Convert.ToInt32(ddlMonth.Items[ddlMonth.SelectedIndex].Value);
// int year = Convert.ToInt32(ddlYear.Items[ddlYear.SelectedIndex].Value);
// int noofWorkingdays = Convert.ToInt32(txtnoofworkingdays.Text);
// TextBox txtNoOfDaysPresents = new TextBox();
// txtNoOfDaysPresents = (TextBox)gvr.Cells[2].FindControl("txtDaysPresent");
// int leavedays;
// ds1 = objStaff.GetStaffAttendanceByLeaves(Convert.ToInt32(lblStudID.Text), month, year);
// leavedays =Convert.ToInt32(ds1.Tables[0].Rows[0][2].ToString());
// txtNoOfDaysPresents.Text = Convert.ToString((noofWorkingdays - leavedays));
// }
// }
// if (chkFullance.Checked==false)
// {
// foreach (GridViewRow gvr in dgrid.Rows)
// {
// TextBox txtNoOfDaysPresents = new TextBox();
// TextBox txtnoofworkingdays = new TextBox();
// txtNoOfDaysPresents = (TextBox)gvr.Cells[2].FindControl("txtDaysPresent");
// txtNoOfDaysPresents.Text = txtnoofworkingdays.Text;
// }
// }
//}
protected void btnAttendance_Click(object sender, EventArgs e)
{
foreach (GridViewRow gvr in dgrid.Rows)
{
Label lblStudID = new Label();
lblStudID = (Label)gvr.Cells[0].FindControl("lblStaffID");
DataSet ds1 = new DataSet();
int month = Convert.ToInt32(ddlMonth.Items[ddlMonth.SelectedIndex].Value);
int year = Convert.ToInt32(ddlYear.Items[ddlYear.SelectedIndex].Value);
int noofWorkingdays = Convert.ToInt32(txtnoofworkingdays.Text);
TextBox txtNoOfDaysPresents = new TextBox();
txtNoOfDaysPresents = (TextBox)gvr.Cells[2].FindControl("txtDaysPresent");
int leavedays;
ds1 = objStaff.GetStaffAttendanceByLeaves(Convert.ToInt32(lblStudID.Text), month, year);
if (ds1.Tables.Count > 0)
{
if (ds1.Tables[0].Rows.Count > 0)
{
leavedays = Convert.ToInt32(ds1.Tables[0].Rows[0][2].ToString());
txtNoOfDaysPresents.Text = Convert.ToString((noofWorkingdays - leavedays));
}
else
{
txtNoOfDaysPresents.Text = txtnoofworkingdays.Text;
}
}
txtNoOfDaysPresents.Enabled = false;
}
}
示例4: New
public async void New(TextBox display)
{
if (await Confirm("Create New?", "Compression App", "Yes", "No"))
{
display.Text = string.Empty;
}
}
示例5: Start
void Start()
{
TextBox = new TextBox();
if (Randomize == true)
{
int randomIndex = UnityEngine.Random.Range(0, RandomItems.Length);
Type = RandomItems[randomIndex];
Quantity = 1;
}
temp = new Item(Type);
temp.Quantity = Quantity;
if (Quantity == 1)
{
TextBox.addText("You received " + temp.Quantity + " " + temp.Name);
}
else if (Quantity > 1)
{
TextBox.addText("You received " + temp.Quantity + " " + temp.Name + "s");
}
sRenderer = GetComponent<SpriteRenderer>();
BoxColl = GetComponent<BoxCollider2D>();
Player = GameObject.FindWithTag("Player").GetComponent<PlayerControls>();
}
示例6: MainForm
public MainForm ()
{
//
// _comboBox
//
_comboBox = new ComboBox ();
_comboBox.DisplayMember = "displaymember";
_comboBox.Location = new Point (8, 8);
_comboBox.Size = new Size (150, 20);
_comboBox.ValueMember = "valuemember";
Controls.Add (_comboBox);
//
// _selectedValueText
//
_selectedValueText = new TextBox ();
_selectedValueText.Location = new Point (8, 40);
_selectedValueText.Size = new Size (150, 20);
_selectedValueText.Text = "";
Controls.Add (_selectedValueText);
//
// MainForm
//
ClientSize = new Size (170, 75);
Location = new Point (400, 100);
StartPosition = FormStartPosition.Manual;
Text = "bug #81611";
Load += new EventHandler (MainForm_Load);
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
List<Event> events = Event.GetAllEvents();
foreach (Event selectedEvent in events)
{
Panel pnlEvent = new Panel();
pnlEvent.ID = selectedEvent.ID.ToString();
pnlEvent.Attributes.Add("class", "panel");
CheckBox chkbxEventName = new CheckBox();
chkbxEventName.ID = "chkbx" + selectedEvent.Name;
chkbxEventName.Text = selectedEvent.Name;
pnlEvent.Controls.Add(chkbxEventName);
for (int i = 0; i < selectedEvent.MaxTeamSize; i++)
{
TextBox txtbxTTID = new TextBox();
txtbxTTID.ID = "TTID" + (i + 1).ToString() + selectedEvent.ID;
txtbxTTID.Attributes.Add("placeholder", "TTID " + (i + 1).ToString());
txtbxTTID.Attributes.Add("style", "display:none;");
pnlEvent.Controls.Add(txtbxTTID);
RegularExpressionValidator rev = new RegularExpressionValidator();
rev.ControlToValidate = txtbxTTID.ClientID;
rev.Attributes.Add("style", "display:none;");
rev.ValidationExpression = "\\d{4}";
rev.ErrorMessage = "*";
pnlEvent.Controls.Add(rev);
}
pnlEvents.Controls.Add(pnlEvent);
}
}
示例8: Page_Init
// 动态创建控件
// 注意:这段代码需要每次加载页面都执行,因此不能放在 if(!IsPostBack) 逻辑判断中
protected void Page_Init(object sender, EventArgs e)
{
// 创建一个 FormRow 控件并添加到 Form2
FormRow row = new FormRow();
row.ID = "rowUser";
Form2.Rows.Add(row);
TextBox tbxUser = new TextBox();
tbxUser.ID = "tbxUserName";
tbxUser.Text = "";
tbxUser.Label = "用户名";
tbxUser.ShowLabel = true;
tbxUser.ShowRedStar = true;
tbxUser.Required = true;
row.Items.Add(tbxUser);
DropDownList ddlGender = new DropDownList();
ddlGender.ID = "ddlGender";
ddlGender.Label = "性别(自动回发)";
ddlGender.Items.Add("男", "0");
ddlGender.Items.Add("女", "1");
ddlGender.SelectedIndex = 0;
ddlGender.AutoPostBack = true;
ddlGender.SelectedIndexChanged += new EventHandler(ddlGender_SelectedIndexChanged);
row.Items.Add(ddlGender);
}
示例9: ChatBox
public ChatBox()
{
Size = new Point(100, 100);
Input = new TextBox();
Input.Size = new Point(100, 35);
Input.Dock = DockStyle.Bottom;
Input.TextCommit += Input_OnTextCommit;
Elements.Add(Input);
Scrollbar = new ScrollBar();
Scrollbar.Dock = DockStyle.Right;
Scrollbar.Size = new Point(25, 25);
Elements.Add(Scrollbar);
Frame = new Frame();
Frame.Dock = DockStyle.Fill;
Frame.Scissor = true;
Elements.Add(Frame);
Output = new Label();
Output.BBCodeEnabled = true;
Output.TextWrap = true;
Output.AutoSize = Squid.AutoSize.Vertical;
Output.Text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
Output.Style = "multiline";
Frame.Controls.Add(Output);
}
示例10: SimpleBinding
public SimpleBinding ()
{
text_box = new TextBox ();
text_box.Left = 10;
text_box.Top = 10;
text_box.Width = Width - 20;
next_button = new Button ();
next_button.Text = "Next";
next_button.Left = Width - 10 - next_button.Width;
next_button.Top = text_box.Bottom + 5;
back_button = new Button ();
back_button.Text = "Back";
back_button.Left = 10;
back_button.Top = text_box.Bottom + 5;
next_button.Click += new EventHandler (NextClick);
back_button.Click += new EventHandler (BackClick);
Controls.Add (text_box);
Controls.Add (next_button);
Controls.Add (back_button);
text_box.DataBindings.Add ("Text", EmployeeList, "Name");
}
示例11: SimpleText
public SimpleText(int i)
: base(i)
{
base.InputElementName = "SimpleText";
tbValue = new TextBox();
tbLabel = new TextBox();
}
示例12: Start
// Use this for initialization
void Start () {
textComponent = textbox.GetComponent<TextBox>();
textComponent.setText("I AM BOSS DOG PET ALL OF ME");
animator = dog.GetComponent<Animator> ();
endActive = false;
barsDone = 0;
}
示例13: PostageRatesTable
public PostageRatesTable()
{
lblOrigin = MakeNewTextBox();
lblDestination = MakeNewTextBox();
lblDeliveryService = MakeNewTextBox();
lblWeight = MakeNewTextBox();
lblCharges = MakeNewTextBox();
lblAvailableDays = MakeNewTextBox();
lblEstimatedDeliveryTime = MakeNewTextBox();
lblOrigin.Text = "Origin";
lblDestination.Text = "Destination";
lblDeliveryService.Text = "Delivery Service";
lblWeight.Text = "Weight";
lblCharges.Text = "Charges (20g, 50g, 100g, per additional 100g)";
lblAvailableDays.Text = "Available Days";
lblEstimatedDeliveryTime.Text = "Estimated Delivery Time";
this.Size = new Size(700, 500);
this.ColumnCount = 7;
this.RowCount = 0;
this.CellBorderStyle = TableLayoutPanelCellBorderStyle.OutsetDouble;
this.AutoSize = true;
this.Controls.Add(lblOrigin);
this.Controls.Add(lblDestination);
this.Controls.Add(lblDeliveryService);
this.Controls.Add(lblWeight);
this.Controls.Add(lblCharges);
this.Controls.Add(lblAvailableDays);
this.Controls.Add(lblEstimatedDeliveryTime);
PopulateTable();
}
示例14: MyForm
public MyForm()
{
lblMessage = new Label();
btnOK = new Button();
btnCancel = new Button();
txtInput = new TextBox();
Text = "Hello World";
ClientSize = new System.Drawing.Size(200, 125);
lblMessage.Location = new System.Drawing.Point(15, 20);
lblMessage.Size = new System.Drawing.Size(175, 24);
lblMessage.Text = "";
txtInput.Location = new System.Drawing.Point(15, 50);
txtInput.Size = new System.Drawing.Size(175, 24);
txtInput.Text = "";
btnOK.Location = new System.Drawing.Point(30, 85);
btnOK.Size = new System.Drawing.Size(60, 30);
btnOK.Text = "&OK";
btnOK.Click += new System.EventHandler(btnOK_Click);
btnCancel.Location = new System.Drawing.Point(120, 85);
btnCancel.Size = new System.Drawing.Size(60, 30);
btnCancel.Text = "&Cancel";
btnCancel.Click += new System.EventHandler(btnCancel_Click);
Controls.Add(lblMessage);
Controls.Add(btnOK);
Controls.Add(txtInput);
Controls.Add(btnCancel);
}
示例15: DrawCreateToonMenu
private void DrawCreateToonMenu()
{
DarkGUI.Instance.ClearAllUI();
var charName = new TextBox("charName", new Rect(XCentre - 50, YCentre, 100, 50));
var isMale = new CheckBox("isMale?", new Rect(XCentre - 50, YCentre - 50, 100, 50));
new Button("Create!", XCentre - 50, YCentre - 150).OnClick += delegate(Button sender) { _network.Send(new CreateCharacter() { Name = charName.Text, isMale = isMale.Checked }); };
}