Namespace:DevExpress.XtraPrinting
Assembly:DevExpress.Printing.v19.2.Core.dll

Syntax
C# |
public void UpdateSize()
|
VB |
Public Sub UpdateSize()
|

Remarks
The UpdateSize method is used to recalculate the size of the entire PageTableBrick by calculating the aggregate size of all the rows it contains.

Example
This example illustrates the use of PageTableBrick. First we create an array of PageInfoBricks, intended to display the current date, page number and company name. Then we create a new PageTableBrick object and populate it with bricks from the array. And finally, we draw the PageTableBrick in the BrickModifier.MarginalHeader page area and preview the report.
The result is shown in the following picture:

C# |
using DevExpress.XtraPrinting;
BrickGraphics brickGraph = printingSystem1.Graph;
Brick[] bricks = new Brick[] { CreateBrick("A Summary of {0:MMMM yyyy}",
PageInfo.DateTime), CreateBrick("Page number is {0} of the total {1} page(s)",
PageInfo.NumberOfTotal), CreateBrick("Developer Express Inc.",
PageInfo.None)};
PageTableBrick table = CreateTable(bricks);
table.Alignment = BrickAlignment.Near;
printingSystem1.Begin();
brickGraph.Modifier = BrickModifier.MarginalHeader;
brickGraph.DrawBrick(table);
printingSystem1.End();
printingSystem1.PreviewFormEx.Show();
private PageTableBrick CreateTable(Brick[] bricks) {
PageTableBrick table = new PageTableBrick();
foreach(Brick brick in bricks) {
TableRow row = table.Rows.AddRow();
row.Bricks.Add(brick);
}
table.UpdateSize();
return table;
}
private Brick CreateBrick(string format, PageInfo info) {
PageInfoBrick infoBrick = new PageInfoBrick();
infoBrick.Format = format;
infoBrick.PageInfo = info;
infoBrick.Sides = BorderSide.None;
infoBrick.Rect = new RectangleF(0, 0, 0, 18);
infoBrick.AutoWidth = true;
return infoBrick;
}
|
VB |
Imports DevExpress.XtraPrinting
Dim brickGraph As BrickGraphics = printingSystem1.Graph
Dim bricks As Brick() = New Brick() { CreateBrick("A Summary of {0:MMMM yyyy}", _
PageInfo.DateTime), CreateBrick("Page number is {0} of the total {1} page(s)", _
PageInfo.NumberOfTotal), CreateBrick("Developer Express Inc.", PageInfo.None)}
Dim table As PageTableBrick = CreateTable(bricks)
table.Alignment = BrickAlignment.Near
printingSystem1.Begin()
brickGraph.Modifier = BrickModifier.MarginalHeader
brickGraph.DrawBrick(table)
printingSystem1.End()
printingSystem1.PreviewFormEx.Show()
Private Function CreateTable(ByVal bricks As Brick()) As PageTableBrick
Dim table As PageTableBrick = New PageTableBrick()
For Each brick As Brick In bricks
Dim row As TableRow = table.Rows.AddRow()
row.Bricks.Add(brick)
Next brick
table.UpdateSize()
Return table
End Function
Private Function CreateBrick(ByVal format As String, ByVal info As _
PageInfo) As Brick
Dim infoBrick As PageInfoBrick = New PageInfoBrick()
infoBrick.Format = format
infoBrick.PageInfo = info
infoBrick.Sides = BorderSide.None
infoBrick.Rect = New RectangleF(0, 0, 0, 18)
infoBrick.AutoWidth = True
Return infoBrick
End Function
|

See Also