Reputation: 1
I am creating in-memory metafile programmatically - for example line charts. I use Graphics.SetClip(..) and Graphics.ResetClip(..) to set max/min of X/Y axis = limit the scope of drawn datapoints.
The result is fine, except of one thing: The resulting image contains empty space on side(s). This empty space belongs to entities trimmed (hidden) by ClippingRegion.
In other words: ClippingRegion hides entities outside the region, but do NOT affect the SIZE of resulting Metafile. Metafile.GetBounds() returns the same result regardless I set ClippingRegion or not.
I need to export resulting metafile to the MS Word, to the disc, to another SW. But it is useless with these empty spaces on sides... :-(
How can this be solved? Thanks in advance
Upvotes: 0
Views: 128
Reputation: 1
I found solution in method
Graphics.DrawImage(Image, SourceRectangle, DestRectangle, GraphicsUnit)
https://msdn.microsoft.com/en-us/library/ms142040(v=vs.110).aspx
Upvotes: 0