ShapefileCategory - image alignment

Hi,

I’ve upgraded from 5.0.2.0 to 5.1.1 and now have a problem with the ShapefileCategory image alignment - the images are now offset - it seems as though they are drawn as if the “DrawingOptions.AlignPictureByBottom” is set to true (it isn’t - I’ve set it to false) - I think maybe it could be ignoring this setting?

Regards,

Rob H

Hello @robhoney

I don’t think there’s an issue with that property; I am actively using it. But of course there could be conditions I’m not aware of. If you change the setting to True, does it change the placement of the picture?

Hi @jerryfaust

No, the image appears in the same place whether the property is set to true or false.

FWIW a couple of years ago we added a bit of code to set it to false, as when we upgraded to 4.9, the placement was off then.

Rob

Hello Rob.

Update: I set up a test and stepped through the OCX. So far, I cannot break it. Here’s the code:

long width, height;
options->picture->get_Width(&width);
options->picture->get_Height(&height);
int wd = static_cast<int>((double)width * options->scaleX/2.0);
int ht = static_cast<int>((double)height * options->scaleY/2.0);
. . .
if (!options->alignIconByBottom)
{
	_graphics->TranslateTransform((float)-wd, (float)-ht);
}
else
{
	_graphics->TranslateTransform((float)-wd, (float)-ht * 2);
}

The image is always translated (shifted left and up), since otherwise it would be drawn with the insertion point being the top-left corner. I went back prior to 5.0.2, and the code is the same.

I can only guess there are some differences, perhaps in drawing properties, that is affecting this. Would you mind posting a small sample of the Category setup code?

Regards,
Jerry.

Hi Jerry,

Thanks for looking into this. In the end I went through and cleaned everything up inside my solution and it looks like I had one bit of code still finding some bits of the previous version. It’s all working now.

Regards,

Rob