Problem after MakeBitmap

i used MakeBitmap in order to export an image of my diagram.

after calling this function i notice that my is being cropped on its right side.
before calling makebitmap
after calling makebitmap

Could you provide more information please? What platform and which version numbers (platform and GoXam)? Is what is seen in the control that which is clipped? Or is it the image in the bitmap? Does the bitmap have the correct contents?

i’ll start from the end,

the bitmap turns out alright after saving it to a file .
what is seen in the control is clipped.
goXam version is 1.2.7.4 and the problem is reproducible on various windows version (7, XP , Etc').
i already tried using LayoutDiagram() and InvalidateAll() but with no luck.

Is this WPF or Silverlight? And which version thereof?
How did you call MakeBitmap?

Wpf 1.2.4.7

i am using a code that was attached to one of the conversations regarding exporting an image of the diagram.
[Code]
Rect bounds = _diagram._diagram.Panel.DiagramBounds;
// important: include link arrows in flow picture.
double width = bounds.Width;
double height = bounds.Height;
double scale = 2.0;
if (width > 2000)
{
scale = 2000/width;
}
if (height > 2000)
{
scale = Math.Min(scale, 2000/height);
}
width *= scale; height *= scale;
var image = _diagram._diagram.Panel.MakeBitmap(new Size(width, height), 96, new Point(bounds.X, bounds.Y), scale);
[/code]

the problem is not related to saving the image to a file as this occurs also when the saing is skipped.

That’s very odd – I’ve never heard or seen that kind of error in WPF.
When you say that it happens “when the saving is skipped”, do you mean when not calling MakeBitmap?
What other code executes when this problem occurs?

After the clipping appears, do mouse actions in the “invisible” area still work as if the rest were visible?

After the clipping happens, what are the ways of restoring the proper appearance?

what i meant by “saving is skipped” is when i dont save the bit map to a file.

i have isolated the problem to makeBitmap call, if i debug the code and skip this call my diagram stays intact.
the invisable parts are not responding.
after the clipping happens its enough to zoom in or out to fix it or to add another element to the diagram for things to go back to normal.
i think it has something to do with the Rect bounds size but i am not sure.

This wouldn’t explain the problem, but why do you start with a scale of 2.0?

Does the size of the diagram relative to the size of the viewport matter in causing the problem?

scale just output a bigger picture to my understanding.

when i select a bigger width (eg width= width* 2;) i can partially solve the problem , a smaller part of the diagram is clipped but if i resize the panel that contains the diagram i still see this problem .
so to my understanding this only moves the "line of clipping" , i hope i am clear enough.
so to your question : setting scale to 1.0 is worse for me.

So if you make the Diagram smaller so that there are scrollbars in both directions, you still have the clipping problem?

i think the clipping is relative to the left edge. if the diagram is closer to the left edge its container you get a smaller part clipped or not at all.

it is like the makeBitmap draws a rectangle starting from the left edge with some given dimension and clips everything that is not contained in that given rectangle. so when i increase the width and scale the clipping doesn't effect my diagram, i am prety sure it is still there, just cant be seen against the white background.
is there any way to refresh the diagram? make it rerender itself, without doing another loading to its model??

I was finally able to reproduce the problem.

As a work-around, try calling MakeBitmap with an Action argument (the optional argument that comes last) that does:
myDiagram.Panel.MakeBitmap(. . .,
bmp => {
var pos = myDiagram.Panel.Position;
myDiagram.Panel.Position = new Point(pos.X, pos.Y+1);
myDiagram.Panel.Position = pos;
});

This is crude but I hope it helps in this situation.