Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Image zoom
Message
From
10/02/2004 15:28:09
 
 
To
10/02/2004 12:49:37
Denis Filer
University of Oxford
United Kingdom
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00875252
Message ID:
00876017
Views:
19
Hi Denis,

An alternative to David's Image solution is to use a web browser. My image control (VFP7) only seems to support bmp and ico formats, which is a bit restrictive. The browser supports umpteen more formats and scroll bars appear automatically when needed.
* First create a small bmp or similar called say hello.bmp
* This seems to be needed to initialise the browser properly.
**************************************************************************
* The code in this block creates a small HTML file to hold a picture at location with id=zoom
* Only need to execute this bit once
SET CONSOLE OFF
SET TEXTMERGE TO C:\temp\zoom.htm
SET TEXTMERGE ON

\<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
\<html>
\<head>
\<title>Zoom a picture</title>
\</head>
\
\<body bgcolor=#d9e7ff>
\   <img alt="" id=zoom src="C:\temp\hello.bmp" width=800 height=600 top=0>
\</body></html>
SET TEXTMERGE OFF
SET TEXTMERGE TO
SET CONSOLE ON
******************************************************************

* Now the programme proper
SET CLASSLIB TO "C:\program files\microsoft visual foxpro 7\gallery\_webview.vcx"
oform1=NEWOBJECT("form1")
oform1.Show
READ EVENTS
RETURN

**************************************************

DEFINE CLASS form1 AS form

	Top = 0
	Left = 0
	Height = 600
	Width = 800
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	zFileName = "c:\temp\zoom.htm"	&& The file created above
	zWidth    = 800			&& Width of the picture displayed
	zHeight   = 600			&& Height of the picture displayed
	zFactor   = 1.5			&& Multiplication factor used in zoom

	ADD OBJECT imgzoom AS _WEBBROWSER4 WITH ;
		Height = 300, ;
		Left = 17, ;
		Top = 12, ;
		Width = 400, ;
		Name = "imgZoom"

	PROCEDURE init
		* Load zoom.htm into browser
		WITH THIS.imgZoom
			.cfilename=This.zFileName
			.Navigate(This.zFileName)
		ENDWITH
	ENDPROC
	
	ADD OBJECT Button1 AS CommandButton WITH ;
		Height = 25,;
		Left = 700,;
		Top = 20,;
		Width = 80,;
		Caption = 'Zoom In'
		
	PROCEDURE Button1.Click
		oDoc = ThisForm.imgZoom.Document
		oZ = oDoc.getElementById('zoom')
		oZ.width = oZ.width*ThisForm.zFactor 
		oZ.height = oZ.height*ThisForm.zFactor 
	ENDPROC
	
	ADD OBJECT Button2 AS CommandButton WITH ;
		Height = 25,;
		Left = 700,;
		Top = 50,;
		Width = 80,;
		Caption = 'Zoom Out'
		
	PROCEDURE Button2.Click
		oDoc = ThisForm.imgZoom.Document
		oZ = oDoc.getElementById('zoom')
		oZ.width = oZ.width/ThisForm.zFactor 
		oZ.height = oZ.height/ThisForm.zFactor 
	ENDPROC
	
	ADD OBJECT Button3 AS CommandButton WITH ;
		Height = 25,;
		Left = 700,;
		Top = 80,;
		Width = 80,;
		Caption = 'Pick Pix'
		
	PROCEDURE Button3.Click
		oDoc = ThisForm.imgZoom.Document
		oZ = oDoc.getElementById('zoom')
		NewFile = GetFile()
		oZ.width = ThisForm.zWidth
		oZ.height = ThisForm.zWidth
		oZ.Src = NewFile
	ENDPROC
	
	PROCEDURE Destroy
		CLEAR EVENTS
	ENDPROC
	
ENDDEFINE
Previous
Reply
Map
View

Click here to load this message in the networking platform