The requested page is not available for the requested platform. You are viewing the content for Default platform.

XRRichText.CanShrink Property

Gets or sets a value indicating whether the control's height can decrease if its text does not completely fill the control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

[Browsable(true)]
[XtraSerializableProperty]
public override bool CanShrink { get; set; }
<Browsable(True)>
<XtraSerializableProperty>
Public Overrides Property CanShrink As Boolean

Property Value

Type Description
Boolean

true if the control's height can decrease in order to remove the unused space; otherwise, false.

Remarks

When the CanShrink property is set to true and the control's contents don't completely fill the control, its height will be decreased to the height of its contents. If there are other controls below the current control, they will be moved up to avoid the unused space. Note that if a control overlaps the shrinking control by even one pixel, it will not be pushed up by the shrinking control.

Note

If the control's XRControl.AnchorVertical property is set to VerticalAnchorStyles.Bottom or VerticalAnchorStyles.Both, the XRRichText.CanGrow and CanShrink property values are ignored, and don't participate in calculating a final height value of this control.

Examples

The following method demonstrates how to create an XRRichText object, set some of its properties, and then save its contents to a text file.

using System;
using DevExpress.XtraReports.UI;
// ...

public XRRichText CreateXRRichText(){
    // Create an XRRichText object.
    XRRichText xrRichText1 = new XRRichText();

    // Set its height to be calculated automatically,
    // and make its borders visible.
    xrRichText1.CanGrow = true;
    xrRichText1.CanShrink = true;         
    xrRichText1.Borders = DevExpress.XtraPrinting.BorderSide.All;

    // Create an array of lines and assign it to the rich text.
    string[] boxLines = new String[3];
    boxLines[0] = "Line 1";
    boxLines[1] = "Line 2";
    boxLines[2] = "Line 3";
    xrRichText1.Lines = boxLines;

    // Export its contents to a text file.
    xrRichText1.SaveFile("output.txt", XRRichTextStreamType.PlainText);

    return xrRichText1;
}
See Also