本文整理匯總了C#中System.Windows.Documents.Span.Span構造函數的典型用法代碼示例。如果您正苦於以下問題:C# Span構造函數的具體用法?C# Span怎麽用?C# Span使用的例子?那麽, 這裏精選的構造函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Span構造函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Run
// A child Inline element for the new Span element.
Run runx = new Run("The Run element derives from Inline, and is therefore" +
"an acceptable child element for this new Span.");
// After this line executes, the new element "spanx"
// contains the specified Inline element, "runx".
Span spanx = new Span(runx);
示例2: Run
// A child Inline element for the new Span element.
Run runx = new Run("The Run element derives from Inline, and is therefore" +
"an acceptable child element for this new Span.");
// An empty paragraph will serve as the container for the new Span element.
Paragraph parx = new Paragraph();
// After this line executes, the new element "spanx"
// contains the specified Inline element, "runx". Also, "spanx" is
// inserted at the point indicated by the insertionPosition parameter,
// which in this case indicates the content start position in the Paragraph
// element "parx".
Span spanx = new Span(runx, parx.ContentStart);
示例3: Paragraph
// Create a paragraph and three text runs to serve as example content.
Paragraph parx = new Paragraph();
Run run1 = new Run("Text run 1.");
Run run2 = new Run("Text run 2.");
Run run3 = new Run("Text run 3.");
// Add the three text runs to the paragraph, separated by linebreaks.
parx.Inlines.Add(run1);
parx.Inlines.Add(new LineBreak());
parx.Inlines.Add(run2);
parx.Inlines.Add(new LineBreak());
parx.Inlines.Add(run3);
// After this line executes, the selection of content
// indicated by the "start" and "end" parameters will be
// enclosed by the new Span. In this case, the new Span
// will enclose the entire contents of the Paragraph "parx",
// which happens to contain three text runs and two linebreaks.
Span spanx = new Span(parx.ContentStart, parx.ContentEnd);
// Now, properties set on "spanx" will override default properties
// on elements contained by "spanx". For example, setting
// these arbitrary display properties on "spanx" will affect
// the child text runs enclosed by "spanx".
spanx.Foreground = Brushes.Blue;
spanx.Background = Brushes.GhostWhite;
spanx.FontFamily = new FontFamily("Century Gothic");
// Non-default property values override any settings on the
// enclosing Span element.
run2.Foreground = Brushes.Red;
run2.Background = Brushes.AntiqueWhite;
run2.FontFamily = new FontFamily("Lucida Handwriting");