In my print preview dialog I have a
PageLayoutControl loading the same map as the main view's
MapControl. I want the map in the
PageLayoutControl to center at the same position as the
Extent is not a solution because the
PageLayoutControl has a fixed ratio (square). (I tried using the same extent, but it didn't work at all.)
I tried the following, but
CenterAt() didn't do the trick.
IEnvelope extent = _mapControl.Extent; double lXMin, lXMax, lYMin, lYMax; lXMin = extent.XMin; lXMax = extent.XMax; lYMin = extent.YMin; lYMax = extent.YMax; IPoint centerPoint = new PointClass(); centerPoint.SpatialReference = _mapControl.SpatialReference; centerPoint.X = lXMin + ((lXMax - lXMin) / 2); centerPoint.Y = lYMin + ((lYMax - lYMin) / 2); _pageLayoutControl.CenterAt(centerPoint);
I don't have MapServer, so I can't use
ICenterAndScale. I didn't find a
MapDescription in the
PageLayoutControl at all.