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


C# RichTextBox.BeginChange方法代码示例

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


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

示例1: InsertBlockLayer

	public void InsertBlockLayer (DataSet FormatierDataSet, DataRow BlockRow, Grid TextGrid, DataRow ContentRow,
				double OriginalWidth, double OriginalHeight)
		{
		double WidthPercentage = MaxPercentage;
		if ((!Convert.IsDBNull (BlockRow ["MaxPositionRight"]))
			&& (!Convert.IsDBNull (BlockRow ["MinPositionLeft"])))
					WidthPercentage = Convert.ToDouble (BlockRow ["MaxPositionRight"]) -
		                         Convert.ToDouble (BlockRow ["MinPositionLeft"]);
		else
			{
			if (!Convert.IsDBNull (BlockRow ["MaxPositionRight"]))
				WidthPercentage = Convert.ToDouble (BlockRow ["MaxPositionRight"]);
			if (!Convert.IsDBNull (BlockRow ["MinPositionLeft"]))
				WidthPercentage = MaxPercentage - Convert.ToDouble (BlockRow ["MinPositionLeft"]);
			}

		double HeightPercentage = MaxPercentage;
		if ((!Convert.IsDBNull (BlockRow ["MaxPositionBottom"]))
			&& (!Convert.IsDBNull (BlockRow ["MinPositionTop"])))
					HeightPercentage = Convert.ToDouble (BlockRow ["MaxPositionBottom"]) -
		                         Convert.ToDouble (BlockRow ["MinPositionTop"]);
		else
			{
			if (!Convert.IsDBNull (BlockRow ["MaxPositionBottom"]))
				HeightPercentage = Convert.ToDouble (BlockRow ["MaxPositionBottom"]);
			if (!Convert.IsDBNull (BlockRow ["MinPositionTop"]))
				HeightPercentage = MaxPercentage - Convert.ToDouble (BlockRow ["MinPositionTop"]);
			}
		double LeftPercentage = 0;
		if (!Convert.IsDBNull (BlockRow ["MinPositionLeft"]))
			LeftPercentage = Convert.ToDouble (BlockRow ["MinPositionLeft"]);
		double TopPercentage = 0;
		if (!Convert.IsDBNull (BlockRow ["MinPositionTop"]))
			TopPercentage = Convert.ToDouble (BlockRow ["MinPositionTop"]);

		double BlockRotation = 0;
		if (!Convert.IsDBNull (BlockRow ["BlockRotation"]))
			BlockRotation = Convert.ToDouble (BlockRow ["BlockRotation"]);
		Grid ElementGrid = CreateGrid
			(new int [] { (int)(LeftPercentage * 100),
		                        (int) (WidthPercentage * 100), 
		                        (int)((MaxPercentage - LeftPercentage - WidthPercentage) * 100) },
			new int [] {(int)(TopPercentage * 100),
		                        (int) (HeightPercentage * 100),
		                        (int)((MaxPercentage - TopPercentage - HeightPercentage) * 100) });
		TextGrid.Children.Add (ElementGrid);
		BrushConverter BRConverter = new BrushConverter ();
		DataRow [] TextsInBlock = FormatierDataSet.Tables ["TextDefinitions"].Select ("BlockID = '"
			+ BlockRow ["ID"].ToString () + "'", "TextPlayingOrder");
		String BlockType = BlockRow ["BlockType"].ToString ();

		if (BlockType == "Text")
			{
			RichTextBox TextBlockFrame = new RichTextBox ();
			FlowDocument Document = new FlowDocument ();
			TextBlockFrame.Document = Document;
			TextBlockFrame.UndoLimit = 0;
			TextBlockFrame.BeginInit ();
			TextBlockFrame.BeginChange ();
			TextBlockFrame.Background = (Brush)BRConverter.ConvertFromString ("Transparent");
			if (!ShowTextFrames)
				{
				TextBlockFrame.BorderBrush = (Brush)BRConverter.ConvertFromString ("Transparent");
				TextBlockFrame.BorderThickness = new Thickness (0);
				}
			TextBlockFrame.Visibility = Visibility.Visible;
			ElementGrid.Children.Add (TextBlockFrame);
			Grid.SetRow (TextBlockFrame, 1);
			Grid.SetColumn (TextBlockFrame, 1);
			TextBlockFrame.Height = ((HeightPercentage) * OriginalHeight) / 100;


			foreach (DataRow DescriptionRow in TextsInBlock)
				{
				try
					{
					InsertTextLayer (DescriptionRow, Document, ContentRow,
									 OriginalWidth, OriginalHeight, OriginalHeight * 0.85);
					}
				catch (Exception Excp)
					{
					throw new Exception ("Fehler bei InsertTextLayer:\r\n" + Excp.ToString());
					}
				}
			TextBlockFrame.EndChange ();
			TextBlockFrame.EndInit ();	
			
			InsertDisposeableElement (TextBlockFrame);
			}

		if (BlockType == "RTF")
			{
			RichTextBox TextBlockFrame = new RichTextBox ();
			TextBlockFrame.UndoLimit = 0;
			TextBlockFrame.BeginInit ();
			TextBlockFrame.BeginChange ();
			TextBlockFrame.Background = (Brush)BRConverter.ConvertFromString ("Transparent");
			if (!ShowTextFrames)
				{
				TextBlockFrame.BorderBrush = (Brush)BRConverter.ConvertFromString ("Transparent");
//.........这里部分代码省略.........
开发者ID:heinzsack,项目名称:DEV,代码行数:101,代码来源:XAMLHandling.cs

示例2: ReAssignInlinesInParagraph

        /// <summary>
        /// 
        /// </summary>
        /// <param name="textBox"></param>
        /// <param name="paragraph"></param>
        /// <param name="inlines"></param>
        /// <param name="cursorNeighboutingElement"></param>
        private void ReAssignInlinesInParagraph(RichTextBox textBox, Paragraph paragraph, LinkedList<Inline> inlines, TextElement cursorNeighboutingElement)
        {
            textBox.BeginChange();
            paragraph.Inlines.Clear();
            paragraph.Inlines.AddRange(inlines);

            if (cursorNeighboutingElement != null) {
                textBox.CaretPosition = cursorNeighboutingElement.ContentEnd;
            }

            textBox.EndChange();
        }
开发者ID:Kaffedreng,项目名称:CodeEditor,代码行数:19,代码来源:TextEditorControl.cs


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