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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Control with scrollbars

Status
Not open for further replies.

craigsboyd

IS-IT--Management
Nov 9, 2002
2,839
US
Who would have thought that trying to put together an image control and a couple of scrollbars was near to impossible. The image cotrol I have is on a page of a pageframe. The image I want to show is 400x400 and the image control max size i can use is 290x290... I don't want the image distorted or resized so I thought, "Hey i'll just put some scrollbars on this". HA! I've found some freeware ocx solutions but would rather not use, and the Kodak image edit control works like a dream but is not freely redistributable. I've read everything I can find on, tried a million things (grid, cotainer, API, etc) and now I must admit I am stumped. Anyone? Slighthaze = NULL
 
slighthaze

Use a borderless, titlebarless form with scrollbars which would be either set with .Visible = .F. or .Left = -1000 and add the .Image control to the form at 0,0 with height and width as 400 x 400, and form size 290 x 290.

In the .Activate() event of the page make the form visible or bring the form into position with .AlwaysOnTop = .T.

In the the .Deactivate() event of the page do the reverse.

Thus as you enter the page, you will find your image in a scrollable container.

See also faq184-218.
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Chris,

Thank you for the reply. I did read that FAQ you pointed out earlier when I was trying to find a pre-posted answer to my problem. I can see how your idea works, but do you feel that it is really a workable solution for this? I guess I am just sitting here thinking and though I could bring the form into position as you pointed out...hmmm, maybe you're right, it does have some possiblities. A little worried that the user could do something I'm not thinking of to mess it up and give away the trick. I have one problem I know for sure...the program this is for is an MDI, and the user could have quite a few of these up at one time, so the AlwaysOnTop can't be used i don't think...but we shall see.

You know I just kept thinking that there had to be a way to add a scrollbar to a container via Windows API or whatever and then slide the image around in the container...would work slick, except I have no way of being able to add a darn scrollbar since I can't see a way to get the handle to the container control for the API calls...will try your suggestion and let you know, thanks again. Slighthaze = NULL
 
Just a couple of other quick things, since this has been a bit of an eye-opener for me in some ways... i have been under the mistaken impression for sometime that most of the controls in VFP are windows, same as in VC++, VB, Delphi, ETC... here are a couple of links to some cut-n-paste code that can be run straight out of the box that proves beyond a shadow of a doubt that VFP controls (exempting forms) are not windows.



Slighthaze = NULL
 
slighthaze

Untested, but you could toggle the .AlwaysOnTop property of the form containing the .Image control in the .GotFocus/LostFocus() events of the main form and leave the image viewing form in position or visible whilst the relevant page in the pageframe is active.

FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top