Image Align

Image Align

Forum member · May 5, 2008
I am having a problem with the horizontal alignment of images. I thought it was just my application, but could not find anything specifically wrong with the code. So I altered the sample code in Web_VB\GeneratorExamples\AllPageElements.aspx.vb for the AddImage function by changing the alignment to Align.Right. The result moved the image LEFT of the center. Changing the alignment to Align.Left moved the image RIGHT of the center. While this is not exactly the same behavior I'm observing in my own application, it has lead me to believe that something may be wrong with the alignment property for images. Can someone please perform the same test and let me know if it is just me? Thanks, Matt

Re: Image Align

Support · May 5, 2008
Hello Matt, The behavior you are seeing is by design. In order to Align the image to the Left, you will have to use Align.Right and the opposite if you want to align the Image to the Right. Thanks, ceTe Software Support Team

Re: Image Align

Forum member · May 5, 2008
Can you please elaborate a bit on what you mean "by design"? Is there a particular reason why it is the reverse of what one might expect? Thanks, Matt

Re: Image Align

Support · May 5, 2008
Hello Matt, Actually yes, that last response was a bit ambiguous; let me explain this in a bit more detail. The Images "alignment" can not be thought of in the same vein as a text's alignment (as in the TextArea or Label). With an Image, the alignment can be thought of more as where the X and Y coordinates will be anchored to the image. So the X and Y location of the Image will not change but the image can shift around (and be anchored to) that X and Y point. I will explain this with a couple examples. So by default, an image is horizontally aligned "Left" and vertically aligned "Top". What this means literally is that the X, Y coordinates of the image will be the top left corner of the Image. Let's say we change the horizontal alignment of the image now to "Right" alignment (and keep the "Top" vAlign), the Image will now (counter intuitively) shift to the left anchoring the image to the top right of the image. Again, just think of it more as the anchor and I that may be a bit more logical. Thanks, ceTe Software Support Team

Re: Image Align

Forum member · May 6, 2008
Thank you very much. This explains the behavior I was getting in my own application as well.