FlowDocument Konstruktory
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Inicializuje novou instanci FlowDocument třídy.
Přetížení
| Name | Description |
|---|---|
| FlowDocument() |
Inicializuje novou prázdnou FlowDocument instanci třídy. |
| FlowDocument(Block) |
Inicializuje novou instanci FlowDocument třídy a přidá zadaný Block prvek jako počáteční obsah. |
FlowDocument()
Inicializuje novou prázdnou FlowDocument instanci třídy.
public:
FlowDocument();
public FlowDocument();
Public Sub New ()
Platí pro
FlowDocument(Block)
Inicializuje novou instanci FlowDocument třídy a přidá zadaný Block prvek jako počáteční obsah.
public:
FlowDocument(System::Windows::Documents::Block ^ block);
public FlowDocument(System.Windows.Documents.Block block);
new System.Windows.Documents.FlowDocument : System.Windows.Documents.Block -> System.Windows.Documents.FlowDocument
Public Sub New (block As Block)
Parametry
Výjimky
block je null.
Příklady
Následující příklad ukazuje použití tohoto konstruktoru. V tomto případě FlowDocument obsahuje blokovou strukturu elementu toku skládající se z textu, který se spouští vnořený do odstavce.
FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));
Dim flowDocSimple As New FlowDocument(New Paragraph(New Run("A bit of text content...")))
Následující příklad programově vytvoří jednoduchou tabulku 2 x 2 a pak pomocí FlowDocument konstruktoru vytvoří novou FlowDocument obsahující tabulku. I když se používá poněkud složitější struktura bloku elementu toku, použití konstruktoru je stejné jako v předchozím příkladu.
// A paragraph with sample text will serve as table content.
Paragraph tableText = new Paragraph(new Run("A bit of text content..."));
Table sampleTable = new Table();
// Create and add a couple of columns.
sampleTable.Columns.Add(new TableColumn());
sampleTable.Columns.Add(new TableColumn());
// Create and add a row group and a couple of rows.
sampleTable.RowGroups.Add(new TableRowGroup());
sampleTable.RowGroups[0].Rows.Add(new TableRow());
sampleTable.RowGroups[0].Rows.Add(new TableRow());
// Create four cells initialized with the sample text paragraph.
sampleTable.RowGroups[0].Rows[0].Cells.Add(new TableCell(tableText));
sampleTable.RowGroups[0].Rows[0].Cells.Add(new TableCell(tableText));
sampleTable.RowGroups[0].Rows[1].Cells.Add(new TableCell(tableText));
sampleTable.RowGroups[0].Rows[1].Cells.Add(new TableCell(tableText));
// Finally, use the FlowDocument constructor to create a new FlowDocument containing
// the table constructed above.
FlowDocument flowDoc = new FlowDocument(sampleTable);
' A paragraph with sample text will serve as table content.
Dim tableText As New Paragraph(New Run("A bit of text content..."))
Dim sampleTable As New Table()
' Create and add a couple of columns.
sampleTable.Columns.Add(New TableColumn())
sampleTable.Columns.Add(New TableColumn())
' Create and add a row group and a couple of rows.
sampleTable.RowGroups.Add(New TableRowGroup())
sampleTable.RowGroups(0).Rows.Add(New TableRow())
sampleTable.RowGroups(0).Rows.Add(New TableRow())
' Create four cells initialized with the sample text paragraph.
sampleTable.RowGroups(0).Rows(0).Cells.Add(New TableCell(tableText))
sampleTable.RowGroups(0).Rows(0).Cells.Add(New TableCell(tableText))
sampleTable.RowGroups(0).Rows(1).Cells.Add(New TableCell(tableText))
sampleTable.RowGroups(0).Rows(1).Cells.Add(New TableCell(tableText))
' Finally, use the FlowDocument constructor to create a new FlowDocument containing
' the table constructed above.
Dim flowDocTable As New FlowDocument(sampleTable)
Poznámky
Platné vstupní typy pro block zahrnutí BlockUIContainer, , ListParagraph, Section, a Table.