• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

Increasing the canvas size of a bitmap via GDI+

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?

1 Solution
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.
Bob LearnedCommented:
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)


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now