Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Image Attributes
Message
De
25/12/2015 17:29:50
 
 
À
25/12/2015 13:47:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01629066
Message ID:
01629299
Vues:
49
I add this demo code for gathering all images in any folder (PNG,JPG,BMP,GIF) into a cursor and rebuild them on a form.
the cursor can be a permanent table (simply uncomment the line : copy to myPermanentTable.dbf in code)
animated gif are also supported.
*begin code
*illustrating the blob field as  stored image-(can maximize the form)-
Public yform
yform=Newobject("yblob")
yform.Show
Read Events
Return

Define Class yblob As Form
	Top = 71
	Left = 48
	Height = 310
	Width = 504
	ShowWindow=2
	AutoCenter=.T.
	Caption = "Blob Image Demo"
	Name = "Form1"

	Add Object image1 As Image With ;
		HEIGHT = 296, ;
		LEFT = 3, ;
		TOP = 8, ;
		WIDTH = 381, ;
		stretch=2,;
		anchor=15,;
		NAME = "Image1"

	Add Object cmdPrevious As CommandButton With ;
		anchor=768, ;
		TOP = 27, ;
		LEFT = 442, ;
		HEIGHT = 27, ;
		WIDTH = 24, ;
		CAPTION = "<", ;
		NAME = "cmdPrevious"

	Add Object cmdNext As CommandButton With ;
		anchor=768, ;
		TOP = 27, ;
		LEFT = 466, ;
		HEIGHT = 27, ;
		WIDTH = 24, ;
		CAPTION = ">", ;
		NAME = "cmdNext"

	Procedure Destroy
		Use In Select([PICTURES])
		Clea Events
	Endproc

	Procedure Init

		Local m.yrep
		m.yrep=Getdi()
		If Empty(m.yrep)
			Return .F.
		Endi
		Set Defa To (yrep)
		Create Cursor PictureS (filename c(150),membin Blob)
		gnbre=Adir(gabase,'*.*')
		j=0
		For i=1 To gnbre
			If  Inlist(Lower(Justext(gabase(i,1))),"png","jpg","bmp","gif")
				Insert Into PictureS Values (gabase(i,1),Filetostr(gabase(i,1)))
				j=j+1
			Endi
		Endfor
		Thisform.Caption=Thisform.Caption+ "     ["+Trans(j)+" images in "+m.yrep+"  ]"
		*Brow
		*copy to myPermanentTable.dbf  &&if want to save all these images as a permanent table (in blob fields)
		Locate
		Thisform.image1.PictureVal=(membin)
	Endproc

	Procedure cmdPrevious.Click
		Sele  PictureS
		If Recno() > 2
			Skip -1
			Thisform.image1.PictureVal = (membin)
			Thisform.Refresh
		Endif
	Endproc

	Procedure cmdNext.Click
		Sele PictureS
		If  !Eof()
			Skip
			Thisform.image1.PictureVal =( membin)
			Thisform.Refresh
		Endif
	Endproc

Enddefine
*endcode
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform