Hello,
we have created our own custom bricks. How we can use a class derived from XRControl that uses our own bricks…?
Please see the attachment.
I've read a lot of the examples, but the examples doesn't solve the problem.
Thank you for your help!
Greetings
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi,
I suggest that you refer to the XtraReports How to: Create a Progress Bar Control article available in the Task-based section of the help. This article should help you create an appropriate control.
Please review this topic and let us know the result.
Thanks,
Andrew
Hello Andrew,
thank you for your answer.
If it's possible please don't refer to the articles e.g. XtraReports How to: Create a Progress Bar Control article, because this article doesn't solve our problem and as well the
article How to: Create a Custom Brick Inherited from a Standard Brick is not really helpful. These examples don't appear to do any custom drawing. The ProgressBar control simply sets the foreground/background color of the visual brick and add this brick to a panelbrick…
I will create my own brick, for example a GraphicBrick as well I will create my own Control (inherited from the XRControl) for the Designer (XtraReports)
I know the article How to add my Custom Control into ToolBox of the XtraReports Designer, this works.
After I add my Custom Control to the XtraReport, I will create a Window (for example you use it with the Chart Wizard) to define my properties.
So I can paint e.g. a System.Windows.Graphics - Object.
We tried this with the bricks (implement our own brick etc…do we need this to solve the problem), but the bricks drive us crazy :-) …Can you help me! I little piece of code in C# would be very helpful.
If this is temporarly impossible, please take this Example as Suggestion for the next Suite Update, but i hope you can help!
Best Regards
Andy
Hi Andy,
I've attached a sample illustrating how you can achieve this design.
Please feel free to contact us in case of any difficulty. We will be happy to assist you.
Thanks,
Andrew
Hi Andrew,
thank you for this example. The problem thereby is, the method (-Draw) in the BrickClass passes the parameters (IGraphics … ).
Is this example realizable instead of IGraphics the parameter <System.Drawing.Graphics> is used?
With best regards
Andy
Hi Andy,
The IGraphicks is an XtraPrintingSystem interface which provides methods similar to the System.Drawing.Graphics to draw the content in the XtraPrinting system.
Could you clarify why you need to use the System.Drawing.Graphics class?
Thanks,
Andrew
Hi Andrew,
we have a graphical in-house component which displays something like shapes, contours, grids and so on. This component draws on an instance of the System.Drawing.Graphics object.
We now want to print out the graphical contents of this component, so I created an own brick (let’s call it ExampleBrick) derived from Accessible and IBrick. The draw method I have to implement (IBrick.Draw) provides me with an instance of a System.Drawing.Graphics object which I need for my component to draw onto it. This works perfectly. For designing my report in XtraReport I also created my own Control derived from XRControl. As you know, I have to override the methods CreateBrick(…) and PutStateToBrick(…). The method CreateBrick(…) returns an instance of VisualBrick, but the problem is now that I cannot cast my ExampleBrick to VisualBrick.
So I derived my ExampleBrick from VisualBrick. The casting now works fine, but not the drawing. VisualBrick doesn’t provide me with a method that has an instance of a System.Drawing.Graphics object as parameter. All the draw methods from VisualBrick like DrawClientContent(…), DrawObject(…), etc. only provide an instance of IGraphics, which I cannot use, because my component can only draw to a System.Drawing.Graphics object as I described above. How can I access a System.Drawing.Graphics object from VisualBrick?
We plan to use XtraReports as well as XtraPrinting, so therefore I definitively need a class derived from XRControl which uses my own brick for designing the report. How can I realize that?
I know there is control called WinControlContainer in XtraReports, but I cannot use it, because the printing quality doesn't meet my company’s requirements.
I’m looking forward for your answer, and thanks for your help in advance,
Andy
Hi Andy,
Thank you for the feedback.
The bricks, which are used in the XtraReport suite, should be inherited from the VisualBrick.
I believe that you may use two different approaches to accomplish this task.
For example:
Bitmap bmp = new Bitmap((int)rect.Width * 3, (int)rect.Height * 3, PixelFormat.Format24bppRgb);
Graphics wgr = Graphics.FromImage(bmp);
wgr.DrawEllipse(new Pen(this.Style.ForeColor), rect);
gr.DrawImage(bmp, rect);
For example:
protected override void Draw(IGraphics gr, RectangleF rect, RectangleF parentRect) {
if(gr is GdiGraphics) {
(((GdiGraphics)gr)).Graphics.DrawEllipse(new Pen(this.Style.ForeColor), rect);
}
}
Please feel free to contact us if you need any additional assistance. We will be happy to help you.
Thanks,
Andrew