Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How Do I store image data in PictureVal
Message
From
19/10/2005 04:51:41
 
 
To
18/10/2005 21:52:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01057389
Message ID:
01060163
Views:
35
>Hi Fabio
>
>Thanks for the tips about Pictureval. I did as you suggested but I am getting strange results. Please see this code:
>
>
>PUBLIC oform1
>
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>**********************************
>DEFINE CLASS form1 AS form
>
>
>	Top = 0
>	Left = 0
>	Height = 217
>	Width = 321
>	DoCreate = .T.
>	Caption = "Form1"
>	Name = "Form1"
>
>
>	ADD OBJECT image1 AS image WITH ;
>		Picture = "buttnormal.bmp", ;
>		Height = 31, ;
>		Left = 47, ;
>		Top = 12, ;
>		Width = 2, ;
>		Name = "Image1"
>
>
>	ADD OBJECT image2 AS image WITH ;
>		Picture = "buttnormal.bmp", ;
>		Stretch = 1, ;
>		Height = 31, ;
>		Left = 47, ;
>		Top = 59, ;
>		Width = 73, ;
>		Name = "Image2"
>
>
>	ADD OBJECT image3 AS image WITH ;
>		Picture = "buttnormal.bmp", ;
>		Stretch = 2, ;
>		Height = 31, ;
>		Left = 47, ;
>		Top = 103, ;
>		Width = 145, ;
>		Name = "Image3"
>
>
>	ADD OBJECT label1 AS label WITH ;
>		WordWrap = .T., ;
>		Caption = "Double click form to run the code. Why is the image with Stretch = 2 (image3)  giving this fading result?", ;
>		Height = 48, ;
>		Left = 36, ;
>		Top = 156, ;
>		Width = 265, ;
>		Name = "Label1"
>
>
>	PROCEDURE DblClick
>		bb=0h424D2E010000000000003600000028000000020000001F0000000100180000000000F8000000130B0000130B00000000000000000000DFA67FDF;
>		+				0hA67F0000E1A881E1A8810000E3AA83E3AA830000E3AC87E3AC870000E3AE89E3AE890000E5B08BE5B08B0000E6B28EE6B28E0000E6B490E6B49000;
>		+				0h00E7B591E7B5910000E8B896E8B8960000E9B997E9B9970000E9BA9AE9BA9A0000EBBC9CEBBC9C0000EDC09FEDC09F0000EDC1A2EDC1A20000EDC4;
>		+				0hA4EDC4A40000EEC5A5EEC5A50000F0C6A9F0C6A90000EFC7AAEFC7AA0000F2CAAEF2CAAE0000F3CCB0F3CCB00000F3CEB2F3CEB20000F3D0B6F3D0;
>		+				0hB60000F5D2B8F5D2B80000F6D3B9F6D3B90000F8D4BCF8D4BC0000F3D8BEF3D8BE0000FDD8C4FDD8C40000F7DCC2F7DCC20000FCDDC6FCDDC60000;
>		+				0hF9DEC9F9DEC90000
>
>		This.image1.PictureVal = bb
>		This.image2.PictureVal = bb
>		This.image3.PictureVal = bb
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: form1
>**************************************************
>
>
>You can use any small bmp for butnormal.BMP The file I used was a blue gradient bmp Width = 2 pixels Ht = 31 pixels.
>
>Image1 and Image2 display as normal on Dbl Click but Image3 with Stretch = 2 displays with a faded look as you will see if you run this code.
>
>Why is this displaying like this with stretch = 2?

Picture uses GDI with a simple duplication / removal of the pixels
PictureVal uses GDI+ and apply a left to right gradient interpolation.
Interesting, I have seen various thread where some have written tons of API call to do this.

try this, and resize the form.
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show

DEFINE CLASS form1 AS form
	Height = 600
	Width = 600
	autocenter = .T.
	backcolor = RGB(255,255,0)

	ADD OBJECT command1 AS commandButton WITH ;
		WordWrap = .T., ;
		Caption = "Click here load the picture into Pictureval.",;
		Height = 40, ;
		Left = 5, ;
		Top = 5, ;
		Width = 265
			
	ADD OBJECT image1 AS image WITH ;
		Anchor = 15,;
		Picture="redpoint.bmp",;
		Height = 31, ;
		Left = 20, ;
		Top = 100, ;
		Width = 2
		
	ADD OBJECT image3 AS image WITH ;
		Anchor = 15,;
		Picture="redpoint.bmp",;
		Stretch = 2, ;
		Height = 31, ;
		Left = 47, ;
		Top = 55, ;
		Width = 300
		
	ADD OBJECT image2 AS image WITH ;
		Anchor = 15,;
		Picture="redpoint.bmp",;
		Stretch = 1, ;
		Left = 30, ;
		Top = 100, ;
		Height = 400, ;
		Width = 200

	PROCEDURE Load
		STRTOFILE(getImage(),"redpoint.bmp")
		
	PROCEDURE command1.Click
		STORE getImage() TO ;
			Thisform.image1.PictureVal;
		,	Thisform.image2.PictureVal;
		,	Thisform.image3.PictureVal
	ENDPROC
ENDDEFINE

PROCEDURE getImage
		* image 1 x 1 RED
		RETURN 0h424D4600000000000000;
		+0h36000000;
		+0h28000000;
		+BINTOC(1,"RS"); && columns
		+BINTOC(1,"RS"); && rows
		+0h01001800000000001000000000000000000000000000000000000000;
		+PADR(RIGHT(BINTOC(RGB(255,0,0),"S"),3),3*1*1+(-3*1*1%4),0h00)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform