Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image alignment

Status
Not open for further replies.

vfp4ever

Programmer
Oct 18, 2013
71
IT
Hello,

I am having some trouble displaying an Image control correctly. I assigned a fixed area for it (300x300 pixel) within a Container, and defined an Image Click method that cycles through a set of files according to a global property (image dimensions vary in both size and orientation). In the Container's Refresh method I wrote:

Code:
WITH .MyImage
[indent].Stretch = 0
.Picture = "image1.jpg"
.Stretch = 1
[/indent]
ENDWITH

and all images display the way I want. In the Image Click method I wrote the same assignments, but the Image control "centres" the image within the control itself and prevents me from displaying it aligned as before (e.g. a 300x200 rectangle appears 50 pixel further down). It does so as if Image controls had an internal Alignment property set to Centered (I can see this behaviour setting BorderStyle=1). Resetting Width and Height to 300 or setting a specific Anchor do not help, as they apply to the entire control.

Has anybody any suggestion? In practice, I would like to keep my image starting from the same point and having the same maximum 300-pixel size, no matter how wide or tall images are.


Regards,
Dario
 
Hello,

If I understand you correctly images are shown fine if run from container click but gets centered if run from image click ?
(I do not understand stretch = 0 / 1)

In image click I would not change stretch but only set .picture and do a refresh.
Does this work ?

You may also have a look here, its a class from tony to make isometric look better, maybe it includes some tricks:)

Regards
tom

Can you upload a sample with some pictures ?
 
Thanks, Tom


Sorry, I did not do my best to explain the problem. I want my Image control to display pictures of various dimensions at either fixed width and/or height at 300 pixels (e.g. Pic1_1, Pic2_1, ... PicN_1). The Image is part of a Page, on which I also have an OptionGroup to select the source of these pictures (Pic1_1, Pic1_2, ... Pic1_5). As an alternative, I want to click on the Image itself so that it loops through all available sources (_1 to _5 and over again).

Initial display of the Image is fine (see picture on grey background
1_steqw9.jpg
), OptionGroup selection is fine too (black background
2_aedwrt.jpg
), but when I click on the Image the picture changes relative position as if it was centered within its control (now the frame is clearly visible
3_nfp4xv.jpg
).

I will look into the post you suggested, thanks.


Regards,
Dario
 
Hello,

now I see.

Does it work if in click y<ou only set .picture and do a refresh() , see above ?

regards
tom

 
Unfortunately I can only see, as an alternative to the picture centered within the frame, the full picture extending to its natural dimension. That happens when I comment out Stretch or Width/Height assignments. An extra Refresh( ) does notthing. I am afraid I cannot use the Image Click event for this purpose. Thanks anyway, Tom.
 
Hello,

strange.

What about putting a transparent shape (with same anchor) on top of image and do it in the click of the shape ?

Regards
tom

 
I tried to overimpose a Shape on my Image and manage the Shape.Click( ), but the behaviour does not change. I feel I have to rearrange the underlying container and see whether that causes this oddity, but right now I must postpone further experiments on this issue until a later time.

Thank you very much Tom for your patience, will come back to this thread some time soon and try to analyze this further.


Regards,
Dario
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top