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


C# TextBox.SelectAll方法代码示例

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


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

示例1: 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

示例2: NextFocus

 public static void NextFocus(TextBox tb, KeyEventArgs e)
 {
     if (e.KeyCode == System.Windows.Forms.Keys.Enter && !bEnter)
     {
         bEnter = true;
         tb.Focus();
         tb.SelectAll();
     }
 }
开发者ID:vuchannguyen,项目名称:lg-py,代码行数:9,代码来源:CommonFunction.cs


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