FlowDocument Konstruktorok

Definíció

Inicializálja a FlowDocument osztály új példányát.

Túlterhelések

Name Description
FlowDocument()

Inicializálja az osztály új, üres példányát FlowDocument .

FlowDocument(Block)

Inicializálja az FlowDocument osztály új példányát, és hozzáad egy adott Block elemet kezdeti tartalomként.

FlowDocument()

Inicializálja az osztály új, üres példányát FlowDocument .

public:
 FlowDocument();
public FlowDocument();
Public Sub New ()

A következőre érvényes:

FlowDocument(Block)

Inicializálja az FlowDocument osztály új példányát, és hozzáad egy adott Block elemet kezdeti tartalomként.

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)

Paraméterek

block
Block

A kezdeti tartalomként hozzáadandó absztrakt Block osztályból származó objektum.

Kivételek

block az null.

Példák

Az alábbi példa a konstruktor használatát mutatja be. Ebben az esetben a FlowDocument folyamatelem blokkszerkezete egy bekezdésbe ágyazott szövegből áll.

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...")))

Az alábbi példa programozott módon létrehoz egy egyszerű 2 x 2 táblát, majd a FlowDocument konstruktor használatával létrehoz egy újat FlowDocument , amely tartalmazza a táblát. Bár valamivel bonyolultabb folyamatelem-blokkszerkezetet használ, a konstruktor használata ugyanaz, mint az előző példában.

// 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)

Megjegyzések

Érvényes bemeneti típusok a következőkhözblock: , BlockUIContainerList, Paragraph, Sectionés Table.

A következőre érvényes: