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

How can I enhance my image?

Tips -N- Tricks

How can I enhance my image?

by  ChrisRChamberlain  Posted    (Edited  )
If you want to emulate some of the functionality of the Kodak Image Edit control such as zooming and scrolling, here's a simple way using native FoxPro controls.

Select a form containing a FoxPro image control, note its .Left and .Top positions, right click on the control and select Cut.

Add a new form and Paste the image control into the new form at .Left = 0, .Top = 0.

The NON DEFAULT properties of the new form should be:-

WITH THISFORM
.AlwaysOnTop = .T.
.BorderStyle = 0
.ScrollBars = 3
.TitleBar = 0
.Left = && Image control .left in original form
.Top = && Image control .top in original form
.Height = && Image control .height
.Width = && Image control .width
ENDIF

In the load event put:-

THIS.Width = && Image control width
*--You will find the form will progressively reduce otherwise.

Save the form.

In the original form's Load event put:-

DO FORM newform NAME oGraphic NOSHOW

Add a spinner control, .spnZoom, with .KeyboardLowValue and .SpinnerLowValue = 100.

In the .spnZoom.InterActiveChange event put:-

WITH oGraphic.imgGraphic
.Height = INT(oGraphic.Height * THIS.Value) / 100
.Width = INT(oGraphic.Width * THIS.Value) / 100
ENDWITH

In the .spnZoom.MouseMove event put:-

oGraphic.Refresh()

In THISFORM.Activate put:-

WITH oGraphic
.imgGraphic.Picture = && Filename
.Show()
ENDWITH

You will probably need to use a Timer to ensure oGraphic does not appear before the form instantiates, to adjust the final position of oGraphic, and ensure oGraphic is released in the Form's Destroy event

You now have, (or appear to have), a zoomable, scrollable Image control.



Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top