Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Border Color
Message
From
02/10/2018 11:05:04
 
 
To
02/10/2018 07:16:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01662372
Message ID:
01662435
Views:
60
Hi Koen , in principe your question is for me !

-The base64 string representation of picture i shipped is too long,that why must scroll to jump to the buttons tools.
-The picture yb.png is created in the source folder to bring an example with container picture as border.click the shape to select it or any another picture.

this is simple way to draw a grid border with the native box() vfp function:
*created on 2 of October 2018
*the code draws a simple colored border with the vfp function Box()
*this is a solution to simulate a grid border (native border  is vfp system window border and don't have any property to change borderWidth,Bordercolor).

PUBLIC oform
oform1=NEWOBJECT("ygrid_border_color")
oform1.Show
read events
RETURN
*
DEFINE CLASS ygrid_border_color AS form
	Height = 296+40
	Width = 700
	ShowWindow = 2
	AutoCenter = .T.
	showtips=.T.
	scalemode=3
	Caption = "draw a simple border on the grid.can resize the form/grid"
	Name = "Form1"

	ADD OBJECT grid1 AS grid WITH ;
		Anchor = 15, ;
		Height =310, ;
		Left =10, ;
		Top = 10, ;
		Width = 670, ;
		Name = "Grid1"

	PROCEDURE grid1.Init
	WITH this
	.recordsource="ycurs"
	.recordsourcetype=1
	.deletemark=.F.
	.recordmark=.F.
	.highlightStyle=2
	.gridlines=0
	.fontsize=11
	.fontname="Courier new"
	.SetAll("DynamicBackColor",  "IIF(MOD(RECNO(), 2) = 0, RGB(255, 255, 255), RGB(255, 255, 190) )","column")
	.refresh
	endwith
	ENDPROC


	PROCEDURE resize  &&draw a simple rectangle bounding the grid with any choosen color
	thisform.cls
	thisform.forecolor=rgb(0,0,64)   &&&getcolor()
	thisform.box(thisform.grid1.Left-1,thisform.grid1.Top-1,thisform.grid1.Left+2+thisform.grid1.Width,thisform.grid1.Top+2+thisform.grid1.Height)
	ENDPROC



	PROCEDURE Load
	Close Data All
	Sele * From Home(1)+"samples\data\customer"  Into Cursor ycurs Readwrite
	Sele ycurs
	ENDPROC

	PROCEDURE Destroy
	clea events
	ENDPROC


ENDDEFINE
*
*-- EndDefine: ygrid_border_color
you can also draw a border with APIs (see winapi examples at https://github.com/VFPX/Win32API/blob/master/samples/sample_256.md (warning drawing erased if moved -put a timer or std winapi processing function to make it persistent).

you can find this axample and others grid stuffs in my blog recently posted: http://yousfi.over-blog.com/2018/10/grid-cosmetics-part-3.html
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform