Hi, all.

I am using the GraphicsPath.GetBounds function to resize a control to the boundaries of the graphics path that it contains. However, it has not been resizing correctly when the path has a rotational transform applied to it. I discovered that the problem was the way I was using GetBounds. Specifically:

I rotate a freshly-minted identitymatrix around a pre-defined center-point:

mRotate.RotateAt(iRotationAngle, ptRotateAt);

Then I get the bounds of a graphics path rotated with that matrix (I do not yet permanently modify the graphics path, because there are some other things I need to do with it first):

rBounds = gpShape.GetBounds(mRotate);

This gives me a boundary rectangle, but it is an incorrect boundary rectangle. That is why my control was resizing improperly (to be specific, it is always too big). As a test, I tried simply applying the matrix to the graphics path, then getting the bounds of the transformed path:

gpShape.Transform(mRotate);
rBounds = gpShape.GetBounds();

This gives me totally different, and correct, bounds. However, I do not wish to use this method because, as noted above, there are other steps I perform beforehand that require the use of the unrotated path, in combination with the boundary dimensions of the rotated path. Cloning the path and applying the transform to the clone just seems silly.

Does anyone know what I am doing that causes these two methods to have such dissimilar outputs? I do not specify a pen size (and in any case, I am using a single-width pen) so I doubt that is affecting GetBounds. Since I am only applying one transform, I cannot see how matrix order would apply. What am I missing?