Nevron Open Vision Documentation
Block Size

Each block in Nevron Text DOM has several properties that allow you to control the block size as well as to specify mininum and maxium size preferences.


This topic contains these sections:
Block Width

The width of a block is controlled from the PreferredWidth, MinWidth and MaxWidth properties. Those properties can be specified either as fixed units (dips) or as percentages of the parent block content width. The following code example shows how to create a paragraph that spans 50% of the parent block width, but is always wider than 50 dips and narrower than 250dips:

Setting Block Width Preferences
Copy Code
NParagraph paragraph = new NParagraph("Paragraph with Preferred Width 50%, Min Width 50 dips, Max Width 250 dips");

paragraph.BackgroundFill = new NColorFill(NColor.LightGray);
paragraph.PreferredWidth = new NMultiLength(ENMultiWidthUnit.Percentage, 50);
paragraph.MinWidth = new NMultiLength(ENMultiWidthUnit.Dip, 50);
paragraph.MaxWidth = new NMultiLength(ENMultiWidthUnit.Dip, 250);

section.Blocks.Add(paragraph);
If you do not specify a preferred width each block will automatically compute a width, depending on the block type. Paragraphs, GroupBlocks, Bullet Lists and Bullet List Items use 100% of the container block content width. Tables will be sized so that the used width is enough to accomodate the cell content in the table.
Block Height

Similarly to block width the block height is controlled from the PreferredHeight, MinHeight and MaxHeight properties. Those properties can be specified either as fixed units (dips) or as percentages of first ancestor block with fixed height. The following code example creates a paragraph that spans 50% of the first ancestor block with fixed height taller than 100 dips and shorter than 250dips:

Setting Block Height Preferences
Copy Code
NParagraph paragraph = new NParagraph("Paragraph with Preferred Height 50%, Min Height 100 dips, Max Height 250 dips");

paragraph.BackgroundFill = new NColorFill(NColor.LightGray);

paragraph.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Percentage, 50);
paragraph.MinHeight = new NMultiLength(ENMultiLengthUnit.Dip, 100);
paragraph.MaxHeight = new NMultiLength(ENMultiLengthUnit.Dip, 250);

section.Blocks.Add(paragraph);
In the absence of an ancestor block with fixed preferred height (PreferredHeight specified in dips) the block will use the document root window area height in web / normal layout or the containing section page content area height in Print layout.
See Also
Send Feedback