CustomControl with Height\Width equals 0.01 throws Exception

Tagged: 

  • Borovyk 9 months, 2 weeks ago

    Hi
    I have a problem with CustomControl in SectionReport. The exception appears on PrintPreview and in Designer, if I set Height\Width from 0.01 to 0 in ActiveReport7 and ActiveReport9. Could you fix this bug?
    Thanks

    Code example:

    CustomControl customControl = new CustomControl(typeof(System.Windows.Forms.TextBox));
                customControl.ImageType = ImageTypes.PNG;
                customControl.Width = 10;
                customControl.Height = 0.01f;
                detail.Controls.Add(customControl);

    On PrintPreview an exception appears:
    Parameter is not valid.
    at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
    at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
    at GrapeCity.ActiveReports.SectionReportModel.CustomControl.#dCn(Object control, Graphics g, ImageTypes imageType, Rectangle drawRect)
    at GrapeCity.ActiveReports.SectionReportModel.CustomControl.#LYA(GraphicsCache cache, Page page, PointF pageOffset, Single startPos, Single endPos)
    at GrapeCity.ActiveReports.SectionReportModel.ARControl.Render(GraphicsCache gRef, Page page, PointF pageOffset, Single startPos, Single endPos)
    at GrapeCity.ActiveReports.SectionReportModel.Section.Render(GraphicsCache cache, Page page, #Ppb drawingLog, PointF pageOffset, Single pageWidth, Single drawStartPos, Single drawEndPos)
    at GrapeCity.ActiveReports.SectionReportModel.Section.Render(GraphicsCache cache, #rqb rData, #Ppb drawingLog)
    at #sxA.#mqb.#LDb()
    at #sxA.#mqb.#SDb(Section section, Int32 insPos)
    at #sxA.#mqb.#SDb(Section section)
    at #sxA.#vqb.#vEb()
    at #sxA.#vqb.#bZA(Page newPage, Single left, Single top, Single right, Single bottom, UInt32 flags, UInt32& status)
    at GrapeCity.ActiveReports.SectionReport.#4yb()
    at GrapeCity.ActiveReports.SectionReport.Run(Boolean syncDocument)
    at GrapeCity.ActiveReports.SectionReport.Run()

  • 195p
    AbdiasM195p 9 months, 2 weeks ago

    The error most likely occurs because you’re using the System.Windows.Forms.TextBox control. The Height property of the TextBox is of type Int32 which might be causing the error.
    I would suggest you to try using GrapeCity.ActiveReports.SectionReportModel.TextBox instead of the MS TextBox, which does not cause an error.

    CustomControl customControl = new CustomControl(typeof(GrapeCity.ActiveReports.SectionReportModel.TextBox));
    customControl.ImageType = ImageTypes.PNG;            
    customControl.Width = 10;
    customControl.Height = 0.01f;
    rpt.Sections["detail"].Controls.Add(customControl);

    If this does not meet your requirement, could you tell the purpose of setting the height to such a small value and the purpose of using the TextBox control.

    Thanks

  • Borovyk 9 months, 2 weeks ago

    System.Windows.Forms.TextBox is an example and it doesn’t matter.
    Why such a small value? Because the user can input such value in a designer and crashes the application.
    The exception occurs in CustomControl before calling Control.Paint function, so I can’t impact on it. Could you not print CustomControl if size is too small for Bitmap?

    Note. If TextBox has zero Height\Width no exceptions occurs.

  • 195p
    AbdiasM195p 9 months, 2 weeks ago

    Let me get in touch with the development team on this and get back to you. I would like to inform that if found to be a bug, the fix would be available in the latest version as ActiveReports 7 is no longer in development. Tracking id – 219652

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.