Hi,
I have added two GoView objects on my form of same height, but of different width.
Sometimes a screenshot helps a lot…
Walter provides some generic help with print preview here: http://www.nwoods.com/forum/forum_posts.asp?TID=582
Hi,
If I understand you correctly, you have two separate GoViews that you want to print at the same time, repeating one GoView on the side of each page. Is that right?
The following GoView.PrintDecoration override accomplishes that. When I was writing this code, I used a GoPalette as the repeating GoView.
[code] protected override void PrintDecoration(Graphics g, PrintPageEventArgs e, int hpnum, int hpmax, int vpnum, int vpmax) {
base.PrintDecoration(g, e, hpnum, hpmax, vpnum, vpmax);
GraphicsContainer before = g.BeginContainer(); // save Graphics state
GoView palette = ...; // get the GoView to be printed on each page
RectangleF pbounds = new RectangleF(palette.PrintDocumentTopLeft, palette.PrintDocumentSize);
// draw into left margin, but not into top-left corner of page
// NB: the palette's Width needs to fit into the margin, otherwise it will overlap with the main view
g.TranslateTransform(Math.Max(0, e.MarginBounds.X-pbounds.Width), e.MarginBounds.Y);
g.ScaleTransform(this.PrintScale, this.PrintScale); // draw at same scale as the rest of the view
g.TranslateTransform(pbounds.X, pbounds.Y); // normalize palette's PrintDocumentTopLeft
foreach (GoLayer layer in palette.Layers) { // draw each palette's document's layers
if (layer.IsInDocument) layer.Paint(g, palette, pbounds);
}
g.EndContainer(before); // restore Graphics state, so that this view will print normally
}
[/code]You will need to fiddle with the positioning of that repeatedly printed GoView. To do that correctly you will need to learn how to define transforms on Graphics. What I have done above might be OK as an initial attempt, but I don’t know the details of your application and how its objects are sized and positioned, so you will need to do that work.
Hi,
Just override it. You already have a class inheriting from GoView, which is where you overrode the PrintDecoration method.
Hi,
Is what you want to do just an issue in printing? Everything is working OK interactively, right?
That’s very odd, because printing, whether for print preview or for actual printing, is just re-rendering all of the GoObjects. So whatever position and appearance they have on screen, they should basically have when printed.
In your case, have you overridden DoMove for the objects in the left view? And does that method find the corresponding object(s) in the right view and just set their Location?
Are you doing anything with graphics transforms or the Paint method, except in the very limited manner that I suggested in the PrintDecoration method in this topic? Note that such manipulations are very limited because of the saving and restoring of the graphics context by using the Graphics.BeginContainer and EndContainer methods. Your code should not be using transforms or Paint to make any GoObject appear somewhere different than it really is.
Hi,
I am not doing anything with graphics transforms or the Paint method, except in the very limited manner that you suggested in the PrintDecoration method in this regard.
I can’t explain that. I don’t recall ever hearing about any case where some GoObject that was Printable didn’t print in the correct spot on the correct page relative to the other GoObjects around it in the GoView.
Without the override of PaintDecoration, does your right-hand GoView print the way you expect?
What kind of GoObject is it that isn’t printing at the expected location? What are the other kinds of GoObjects that do print at the expected locations?