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


C# TextBox.Init方法代码示例

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


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

示例1: Console

		public Console(Manager manager)
			: base(manager) {
			Width = 320;
			Height = 160;
			MinimumHeight = 64;
			MinimumWidth = 64;
			CanFocus = false;

			Resizable = false;
			Movable = false;

			cmbMain = new ComboBox(manager);
			cmbMain.Init();
			cmbMain.Top = Height - cmbMain.Height;
			cmbMain.Left = 0;
			cmbMain.Width = 128;
			cmbMain.Anchor = EAnchors.Left | EAnchors.Bottom;
			cmbMain.Detached = false;
			cmbMain.DrawSelection = false;
			cmbMain.Visible = channelsVisible;
			Add(cmbMain, false);

			txtMain = new TextBox(manager);
			txtMain.Init();
			txtMain.Top = Height - txtMain.Height;
			txtMain.Left = cmbMain.Width + 1;
			txtMain.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			txtMain.Detached = false;
			txtMain.Visible = textBoxVisible;
			txtMain.KeyDown += new KeyEventHandler(txtMain_KeyDown);
			txtMain.GamePadDown += new GamePadEventHandler(txtMain_GamePadDown);
			txtMain.FocusGained += new EventHandler(txtMain_FocusGained);
			Add(txtMain, false);

			sbVert = new ScrollBar(manager, EOrientation.Vertical);
			sbVert.Init();
			sbVert.Top = 2;
			sbVert.Left = Width - 18;
			sbVert.Anchor = EAnchors.Right | EAnchors.Top | EAnchors.Bottom;
			sbVert.Range = 1;
			sbVert.PageSize = 1;
			sbVert.Value = 0;
			sbVert.ValueChanged += new EventHandler(sbVert_ValueChanged);
			Add(sbVert, false);

			ClientArea.Draw += new DrawEventHandler(ClientArea_Draw);

			buffer.ItemAdded += new EventHandler(buffer_ItemAdded);
			channels.ItemAdded += new EventHandler(channels_ItemAdded);
			channels.ItemRemoved += new EventHandler(channels_ItemRemoved);

			PositionControls();
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:53,代码来源:Console.cs

示例2: Initialize

		public override void Initialize() {
			base.Initialize();

			Window win = new Window(WindowManager);
			win.Init();
			win.Text = "Account Login";
			win.Width = 350;
			win.Height = 150;
			win.Center();
			win.Resizable = false;
			win.Movable = false;
			win.StayOnTop = true;
			win.Shadow = false;
			win.CloseButtonVisible = false;
			win.IconVisible = false;
			win.FocusLost += delegate(object sender, WindowLibrary.Controls.EventArgs e) {
				win.Focused = true;
			};
			win.Visible = true;

			Label lbl = new Label(WindowManager);
			lbl.Init();
			lbl.Parent = win;
			lbl.Text = "Name";
			lbl.Left = 20;
			lbl.Top = 20;
			win.Add(lbl);

			mUsername = new TextBox(WindowManager);
			mUsername.Init();
			mUsername.Parent = win;
			mUsername.Left = 80;
			mUsername.Top = 20;
			mUsername.Width = win.ClientWidth - 160;
			mUsername.Focused = true;
			mUsername.KeyPress += new KeyEventHandler(txt_KeyPress);
			win.Add(mUsername);

			lbl = new Label(WindowManager);
			lbl.Init();
			lbl.Parent = win;
			lbl.Text = "Passwort";
			lbl.Left = 20;
			lbl.Top = 40;
			win.Add(lbl);

			mPassword = new TextBox(WindowManager);
			mPassword.Init();
			mPassword.Parent = win;
			mPassword.Left = 80;
			mPassword.Top = 40;
			mPassword.Width = win.ClientWidth - 160;
			mPassword.PasswordChar = '*';
			mPassword.Mode = ETextBoxMode.Password;
			mPassword.KeyPress += new KeyEventHandler(txt_KeyPress);
			win.Add(mPassword);

			mSubmitButton = new Button(WindowManager);
			mSubmitButton.Init();
			mSubmitButton.Parent = win;
			mSubmitButton.Text = "Login";
			mSubmitButton.Width = 72;
			mSubmitButton.Height = 24;
			mSubmitButton.Left = win.ClientWidth - 74;
			mSubmitButton.Top = win.ClientHeight - 26;
			mSubmitButton.Anchor = EAnchors.Bottom | EAnchors.Right;
			mSubmitButton.Click += new WindowLibrary.Controls.EventHandler(mSubmitButton_Click);
			win.Add(mSubmitButton);

			AddWindow(win);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:71,代码来源:Screen.Login.cs

示例3: btnRandom_Click

		void btnRandom_Click(object sender, Controls.EventArgs e) {
			Window win = new Window(Manager);
			Button btn = new Button(Manager);
			TextBox txt = new TextBox(Manager);

			win.Init();
			btn.Init();
			txt.Init();

			win.ClientWidth = 320;
			win.ClientHeight = 160;

			win.MinimumWidth = 128;
			win.MinimumHeight = 128;

			Random r = new Random((int)Central.Frames);
			win.ClientWidth += r.Next(-100, +100);
			win.ClientHeight += r.Next(-100, +100);

			win.Left = r.Next(200, Manager.ScreenWidth - win.ClientWidth / 2);
			win.Top = r.Next(0, Manager.ScreenHeight - win.ClientHeight / 2);
			win.Closed += new WindowClosedEventHandler(win_Closed);

			/*
			  win.Width = 1024;
			  win.Height = 768;
			  win.Left = 220;
			  win.Top = 0;
			  win.StayOnBack = true;
			  win.SendToBack();
		*/
			btn.Anchor = EAnchors.Bottom;
			btn.Left = (win.ClientWidth / 2) - (btn.Width / 2);
			btn.Top = win.ClientHeight - btn.Height - 8;
			btn.Text = "OK";

			win.Text = "Window (" + win.Width.ToString() + "x" + win.Height.ToString() + ")";

			txt.Parent = win;
			txt.Left = 8;
			txt.Top = 8;
			txt.Width = win.ClientArea.Width - 16;
			txt.Height = win.ClientArea.Height - 48;
			txt.Anchor = EAnchors.All;
			txt.Mode = ETextBoxMode.Multiline;
			txt.Text = "This is a Multiline TextBox.\n" +
					   "Allows to edit large texts,\n" +
					   "copy text to and from clipboard,\n" +
					   "select text with mouse or keyboard\n" +
					   "and much more...";

			txt.SelectAll();
			txt.Focused = true;
			//txt.ReadOnly = true;

			txt.ScrollBars = EScrollBars.Both;

			win.Add(btn, true);
			win.Show();
			Manager.Add(win);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:61,代码来源:Logic.cs

示例4: TaskControls

		public TaskControls(Manager manager)
			: base(manager) {
			MinimumWidth = 340;
			MinimumHeight = 140;
			Height = 480;
			Center();
			Text = "Controls Test";

			TopPanel.Visible = true;
			Caption.Text = "Information";
			Description.Text = "Demonstration of various controls available in Window Library";
			Caption.TextColor = Description.TextColor = new Color(96, 96, 96);

			grpEdit = new GroupPanel(Manager);
			grpEdit.Init();
			grpEdit.Parent = this;
			grpEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right;
			grpEdit.Width = ClientWidth - 200;
			grpEdit.Height = 160;
			grpEdit.Left = 8;
			grpEdit.Top = TopPanel.Height + 8;
			grpEdit.Text = "EditBox";

			pnlControls = new Panel(Manager);
			pnlControls.Init();
			pnlControls.Passive = true;
			pnlControls.Parent = this;
			pnlControls.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right;
			pnlControls.Left = 8;
			pnlControls.Top = grpEdit.Top + grpEdit.Height + 8;
			pnlControls.Width = ClientWidth - 200;
			pnlControls.Height = BottomPanel.Top - 32 - pnlControls.Top;
			pnlControls.BevelBorder = EBevelBorder.All;
			pnlControls.BevelMargin = 1;
			pnlControls.BevelStyle = EBevelStyle.Etched;
			pnlControls.Color = Color.Transparent;

			lblEdit = new Label(manager);
			lblEdit.Init();
			lblEdit.Parent = grpEdit;
			lblEdit.Left = 16;
			lblEdit.Top = 8;
			lblEdit.Text = "Testing field:";
			lblEdit.Width = 128;
			lblEdit.Height = 16;

			txtEdit = new TextBox(manager);
			txtEdit.Init();
			txtEdit.Parent = grpEdit;
			txtEdit.Left = 16;
			txtEdit.Top = 24;
			txtEdit.Width = grpEdit.ClientWidth - 32;
			txtEdit.Height = 20;
			txtEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right | EAnchors.Bottom;
			txtEdit.Text = "Text";

			rdbNormal = new RadioButton(manager);
			rdbNormal.Init();
			rdbNormal.Parent = grpEdit;
			rdbNormal.Left = 16;
			rdbNormal.Top = 52;
			rdbNormal.Width = grpEdit.ClientWidth - 32;
			rdbNormal.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			rdbNormal.Checked = true;
			rdbNormal.Text = "Normal mode";
			rdbNormal.ToolTip.Text = "Enables normal mode for TextBox control.";
			rdbNormal.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged);

			rdbPassword = new RadioButton(manager);
			rdbPassword.Init();
			rdbPassword.Parent = grpEdit;
			rdbPassword.Left = 16;
			rdbPassword.Top = 68;
			rdbPassword.Width = grpEdit.ClientWidth - 32;
			rdbPassword.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			rdbPassword.Checked = false;
			rdbPassword.Text = "Password mode";
			rdbPassword.ToolTip.Text = "Enables password mode for TextBox control.";
			rdbPassword.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged);

			chkBorders = new CheckBox(manager);
			chkBorders.Init();
			chkBorders.Parent = grpEdit;
			chkBorders.Left = 16;
			chkBorders.Top = 96;
			chkBorders.Width = grpEdit.ClientWidth - 32;
			chkBorders.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			chkBorders.Checked = false;
			chkBorders.Text = "Borderless mode";
			chkBorders.ToolTip.Text = "Enables or disables borderless mode for TextBox control.";
			chkBorders.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(chkBorders_CheckedChanged);

			chkReadOnly = new CheckBox(manager);
			chkReadOnly.Init();
			chkReadOnly.Parent = grpEdit;
			chkReadOnly.Left = 16;
			chkReadOnly.Top = 110;
			chkReadOnly.Width = grpEdit.ClientWidth - 32;
			chkReadOnly.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			chkReadOnly.Checked = false;
//.........这里部分代码省略.........
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:101,代码来源:TaskControls.cs


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