Suggestion: Improved GetExportSizeAndPos

GetExportSizeAndPos determines the portion of a diagram that will be returned as a bitmap. However the GetDiagramWidth/Height/Left/Top functions that determine the size look at all objects on the diagram, including non-visible objects. This can result in a bitmap having extraneous white space when a hidden object is outside the visible objects.
I would like to suggest the 4 GetDiagram.... functions be changed to return the value of only visible and non-group objects:

function TatDiagram.GetDiagramWidth: integer;
var
  c: integer;
begin
  result := 0;
  for c := 0 to DControlCount - 1 do
    if DControls[c].Visible and (DControls[c].IsGroup = false) then
      result := Max(Round(DControls[c].SurroundRect.Right), result);
end;

IsGroup = false is necessary as a group's size is determined by it's member objects, some of which may be hidden.

Secondly, the GetExportSizeAndPos returns the width-1 and height-1 of the objects so any bimap will be missing one pixel from the right and bottom.

That's a valid and fair request. I'd suggest though that we create for new properties: GetDiagramVisibleWidth, GetDiagramVisibleHeight, GetDiagramVisibleLeft and GetDiagramVisiblrTop, and those are the ones to be used by GetExportSizeAndPos.

Does it make sense?

Also moving this to features and requests.

I bow to your superior knowledge on these matters, as long as PaintToBitmap etc. do what I need :blush:

... Will you also address the width-1, height-1 issue as well?

That is more subtle, where exactly does it return width - 1? Do you have a way to demonstrate a problem happening?

I tried a simple test app and - of course - the problem does not show up there! I will have to do some more digging into my big app to see what is happening.....