Increasing the canvas size of a bitmap via GDI+

Posted on 2005-04-28
Last Modified: 2010-04-23
I am builiding a chart from a database using the gdi+.  The problem is that I won't know the size of the final bitmap until the end.

How do I add on to the size of the bitmap?

Question by:dbashley1
    LVL 14

    Expert Comment

    I don't think you can, I think you would have to create a new bitmap with the new size and then copy the old one into the new one.
    LVL 96

    Accepted Solution

    Do you know the coordinates and dimensions for each object that you are adding to the chart?

    If so, then you can scan each object before drawing to determine the ultimate size of the completed image, by looking at the location + size of each object.

    MaxX = Math.Max(MaxX, Object.Left + Object.Width)
    MaxY = Math.Max(MaxY, Object.Top + Object.Height)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now