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


C# RichTextBox.SelectAll方法代码示例

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


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

示例1: InsertRTFLayer

	public void InsertRTFLayer (DataRow DescriptionRow, RichTextBox RTFDocument, DataRow ContentRow,
					double OriginalWidth, double OriginalHeight, double FontSizingBase)
		{
		String TextToWrite = CVM.CommonValues.ProcessCommonTextSubstitutions (DescriptionRow ["Text"].ToString ());
		if ((String.IsNullOrEmpty (TextToWrite))
			&& (!String.IsNullOrEmpty (DescriptionRow ["DataBaseItem"].ToString ())))
			TextToWrite = ContentRow [DescriptionRow ["DataBaseItem"].ToString ()].ToString ();

		double WidthPercentage = MaxPercentage;
		if ((!Convert.IsDBNull (DescriptionRow ["PositionRight"]))
			&& (!Convert.IsDBNull (DescriptionRow ["PositionLeft"])))
			WidthPercentage = Convert.ToDouble (DescriptionRow ["PositionRight"]) -
						 Convert.ToDouble (DescriptionRow ["PositionLeft"]);
		else
			{
			if (!Convert.IsDBNull (DescriptionRow ["PositionRight"]))
				WidthPercentage = Convert.ToDouble (DescriptionRow ["PositionRight"]);
			if (!Convert.IsDBNull (DescriptionRow ["PositionLeft"]))
				WidthPercentage = MaxPercentage - Convert.ToDouble (DescriptionRow ["PositionLeft"]);
			}

		double HeightPercentage = MaxPercentage;
		if ((!Convert.IsDBNull (DescriptionRow ["PositionBottom"]))
			&& (!Convert.IsDBNull (DescriptionRow ["PositionTop"])))
			HeightPercentage = Convert.ToDouble (DescriptionRow ["PositionBottom"]) -
						 Convert.ToDouble (DescriptionRow ["PositionTop"]);
		else
			{
			if (!Convert.IsDBNull (DescriptionRow ["PositionBottom"]))
				HeightPercentage = Convert.ToDouble (DescriptionRow ["PositionBottom"]);
			if (!Convert.IsDBNull (DescriptionRow ["PositionTop"]))
				HeightPercentage = MaxPercentage - Convert.ToDouble (DescriptionRow ["PositionTop"]);
			}
		double LeftPercentage = 0;
		if (!Convert.IsDBNull (DescriptionRow ["PositionLeft"]))
			LeftPercentage = Convert.ToDouble (DescriptionRow ["PositionLeft"]);
		double TopPercentage = 0;
		if (!Convert.IsDBNull (DescriptionRow ["PositionTop"]))
			TopPercentage = Convert.ToDouble (DescriptionRow ["PositionTop"]);


		double FontPercentage = 5;
		if (!Convert.IsDBNull (DescriptionRow ["FontSize"]))
			if (!String.IsNullOrEmpty (DescriptionRow ["FontSize"].ToString ()))
				FontPercentage = Convert.ToDouble (DescriptionRow ["FontSize"]);

		String FontDescription = "Arial";
		if (!Convert.IsDBNull (DescriptionRow ["FontDescription"]))
			if (!String.IsNullOrEmpty (DescriptionRow ["FontDescription"].ToString ()))
				FontDescription = DescriptionRow ["FontDescription"].ToString ();

		String FontWeight = "Normal";
		if (!Convert.IsDBNull (DescriptionRow ["FontStyle"]))
			if (!String.IsNullOrEmpty (DescriptionRow ["FontStyle"].ToString ()))
				FontWeight = DescriptionRow ["FontStyle"].ToString ();

		String FontColor = "Black";
		if (!Convert.IsDBNull (DescriptionRow ["FontColor"]))
			if (!String.IsNullOrEmpty (DescriptionRow ["FontColor"].ToString ()))
				FontColor = DescriptionRow ["FontColor"].ToString ();

		String ConvertContent = String.Empty;
		if (!Convert.IsDBNull (DescriptionRow ["ConvertContent"]))
			ConvertContent = DescriptionRow ["ConvertContent"].ToString ();
		String ConverterParameter = String.Empty;
		if (!Convert.IsDBNull (DescriptionRow ["ConverterParameter"]))
			ConverterParameter = DescriptionRow ["ConverterParameter"].ToString ();

		if (ConvertContent == "ToUpper")
			TextToWrite = TextToWrite.ToUpper ();
		if (ConvertContent == "FormatedDate")
			{
			try
				{
				DateTime WorkingDate = DateTime.Parse (TextToWrite);
				if (String.IsNullOrEmpty (ConverterParameter))
					TextToWrite = WorkingDate.ToString ();
				else
					TextToWrite = WorkingDate.ToString (ConverterParameter);
				}
			catch (Exception)
				{
				}
			}

		String ForceNewLine = String.Empty;
		if (!Convert.IsDBNull (DescriptionRow ["ForceNewLine"]))
			ForceNewLine = DescriptionRow ["ForceNewLine"].ToString ();

		String Alignment = String.Empty;
		if (!Convert.IsDBNull (DescriptionRow ["Alignment"]))
			Alignment = DescriptionRow ["Alignment"].ToString ();

		RTFDocument.SelectAll ();
		RTFDocument.Selection.Load(new MemoryStream (ASCIIEncoding.Default.GetBytes (TextToWrite)), DataFormats.Rtf);


		}
开发者ID:heinzsack,项目名称:DEV,代码行数:98,代码来源:XAMLHandling.cs

示例2: DeleteString

 public void DeleteString(RichTextBox rtb, FlowDocument fd)
 {
     rtb.SelectAll();
     rtb.Selection.Text = "";
     FlowDocSettings(fd);
 }
开发者ID:RoboLOGO,项目名称:IDE,代码行数:6,代码来源:RTextboxHelper.cs

示例3: Text

		public void Text ()
		{
			TextSelection ts = rtb.Selection;

			ts.Text = "Moon";
			Assert.AreEqual (String.Empty, ts.Text, "#0");

			rtb.SelectAll ();
			Assert.AreEqual ("Moon", rtb.Selection.Text, "#1");
			Assert.AreEqual ("Moon", ts.Text, "#2");
			rtb = new RichTextBox ();

			ts = rtb.Selection;
			CreateAsyncTest (rtb,
					 () => {
						 ts.Text = "Hello";
						 Assert.AreEqual (String.Empty, ts.Text, "#3");
					 },
					 () => {
						 Assert.AreEqual (String.Empty, ts.Text, "#4");
						 Assert.AreEqual (String.Empty, rtb.Selection.Text, "#5");
						 rtb.SelectAll ();
						 Assert.AreEqual ("Hello", rtb.Selection.Text, "#6");
					 });
		}
开发者ID:snorp,项目名称:moon,代码行数:25,代码来源:TextSelectionTest.cs

示例4: PastePlainTextCommand

 private void PastePlainTextCommand(object sender, ExecutedRoutedEventArgs e)
 {
     RichTextBox rtb = new RichTextBox();
     rtb.Paste();
     rtb.SelectAll();
     rtb.Selection.ClearAllProperties();
     rtb.Copy();
     richTextBox_Main.Paste();
 }
开发者ID:WilStead,项目名称:IdeaTree,代码行数:9,代码来源:MainWindow.xaml.cs


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