本文整理汇总了C#中System.Windows.Controls.RichTextBox.EndChange方法的典型用法代码示例。如果您正苦于以下问题:C# RichTextBox.EndChange方法的具体用法?C# RichTextBox.EndChange怎么用?C# RichTextBox.EndChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.RichTextBox
的用法示例。
在下文中一共展示了RichTextBox.EndChange方法的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");
//.........这里部分代码省略.........
示例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();
}