Getting the center point

Walter,
In a GoView, how do I get the document coordinates of the center of where the document is being viewed? I’d like to have an insert command that inserts an object directly in the center of the GoView, no matter where the user is looking in the document. I realize this is probably really simple, but I can’t seem to find it anywhere.
Thanks, Tyler

People do seem to want to find the center of a GoView in document coordinates fairly often, so I’m thinking we should add this property to GoView:
[Browsable(false)]
public PointF DocExtentCenter {
get {
PointF pos = this.DocPosition;
SizeF siz = this.DocExtentSize;
return new PointF(pos.X + siz.Width/2, pos.Y + siz.Height/2);
}
set {
SizeF siz = this.DocExtentSize;
this.DocPosition = new PointF(value.X - siz.Width/2, value.Y - siz.Height/2);
}
}
Of course you don’t need to implement this property in a subclass of GoView – you can just adapt the getter code:
PointF pos = goView1.DocPosition;
SizeF siz = goView1.DocExtentSize;
PointF center = new PointF(pos.X + siz.Width/2, pos.Y + siz.Height/2);

Thanks Walter, that works wonders :).