Hallo,
I have a inherited XRPanel and want to show in the designer my own Text.
I overrides the OnDraw-Sub --> It works fine.
Now I also have a own inherited XRSubreport. But here the Overrides do not work.
How can I show my Data in then Designer for a inherited XRSubreport?
Public Class MySubreport
Inherits XRSubreport
Protected Overrides Sub OnDraw(e As DrawEventArgs)
If Me.DesignMode Then
Dim F As New Font("Arial", 8)
Dim FMT As New System.Drawing.StringFormat
FMT.Alignment = StringAlignment.Center
FMT.LineAlignment = StringAlignment.Center
Dim sText = "Hallo" & vbCrLf & Me.GetType.Name
Using BR As New SolidBrush(Color.Blue)
e.UniGraphics.DrawString(sText, F, BR, e.Bounds, FMT)
End Using
Else
MyBase.OnDraw(e)
End If
End Sub
End Class
Many Thanks.
How to show custom infos in then Designer for a inherited XRSubreport?
Answers approved by DevExpress Support
Hi Torsten,
The OnDraw method is never called by the XRSubreport. If you wish to change the text displayed by this component at design-time, you'll need to create a proper report control and register a new brick type produced by this component: Creating Custom Controls. That is, a document is a collection of Visual Bricks - there are no controls and you should not rely on their properties (rather, you should access the properties at the Brick level). Moreover, any custom drawing is only visible in the print preview, it is not preserved in any of the available export formats. As for a real code example, please take a look at the following example here, I believe it is very close to what you're after: BrickExporter - Creation of a custom report control. In our particular case, the XRSubreport uses different presenters. You'll need to override XRSubreport.CreatePresenter and implement your own version of the DesignSubreportPresenter (by default, this presenter created a TextBrick with the subreport path information). This class is private, but you can easily replicate it. I see you own a source-based subscription, so take a look at the following directory for the source code: *C:\Program Files (x86)\DevExpress 14.1\Components\Sources\DevExpress.XtraReports\DevExpress.XtraReports\Native\Presenters*
Let me know if you find this information helpful.