Ok cancel that I did it just now.
I've got the solution. I managet to render whole map offscreen using API PrintWindow on W7 Vista and XP 🙂
PrintWindow using client area is not working correctly on XP but there is work around using SetWorldTranstorm to move Graphics area to the right position.
If some one else will search solution for this, here is how I did it.
1. Create Static Render manager class, which starts STA thread and in this thread creates Form wich contains ADR ActiveX Control. STA thread is required for ActiveX controls.
2. Move created window offscreen and use it to load DWF file
3. SetView to chanche viewing area (as herbert said)
4. use API "PrintWindow" to get ActiveX control graphic inside hosting form
<code>
/// method inside scope of Panel user Coontrol that contains AxCExpressViewerControl
// ensure thant ParentForm Handle is Created befor invoke this method by refering to ParentForm.Handle
// in other case InvokeRequired will fail
public void PrintWindow(Bitmap bitmap)
{
if (ParentForm.InvokeRequired)
{ // invoke from parent form thred to avoid cross thread exception
ParentForm.Invoke(new MethodInvoker(delegate() { PrintWindow(bitmap); }));
return;
}
IntPtr hWnd = this.ParentForm.Handle;
// get this panel offset inside Form
Point pointToClient = this.PointToClient(this.ParentForm.Location);
using (Graphics tmp = Graphics.FromImage(bitmap))
{
IntPtr gHDC = tmp.GetHdc();
// GDI32 & User32 are imported from pinvoke.net C# definitions
GDI32.SetGraphicsMode(gHDC, 2);
GDI32.XFORM F =
new GDI32.XFORM(1,0,0,1,pointToClient.X,pointToClient.Y);
// set wold transform to get only client area - beacause CM_CLIENTFLAG for PrintWindow method is shifting graphics wrong way in Windows XP
GDI32.SetWorldTransform(gHDC, ref F);
// Print whole window to graphics whit world transform
User32.PrintWindow(hWnd,gHDC , 0);
tmp.ReleaseHdc();
}
}
</code>