回复 30楼 吹水佬
这个可以啊,谢谢版主,我好好消化消化
回复 30楼 吹水佬
谢谢!
程序代码:CREATE CURSOR tt (f1 v(10))
FOR i=1 TO 20
INSERT INTO tt VALUES (REPLICATE(PADL(i,2,"0"),10))
ENDFOR
GO TOP
of = CREATEOBJECT("form1")
of.show(1)
RETURN
DEFINE CLASS form1 as Form
AllowOutput = .f.
AutoCenter = .t.
ADD OBJECT cmd as commandbutton WITH left=10,top=10,height=24,caption="Enabled=.F."
ADD OBJECT grd as grid1
PROCEDURE cmd.click
this.Caption = "Enabled="+TRANSFORM(thisform.grd.Enabled)
thisform.grd.Enabled = !thisform.grd.Enabled
ENDPROC
ENDDEFINE
DEFINE CLASS grid1 as Grid
left=10
top=40
width=200
RowHeight=32
HeaderHeight=0
GridLines=0
DeleteMark=.f.
RecordMark=.f.
AllowCellSelection=.f.
SplitBar=.f.
ScrollBars=2
icoIndex = 1
PROCEDURE init
this.AddObject("imgCol","Column1")
this.imgCol.ColumnOrder = 1
ENDPROC
PROCEDURE AfterRowColChange(nColIndex)
IF this.RowColChange == 1
this.icoIndex = RECNO()
this.SetFocus
ENDIF
ENDPROC
ENDDEFINE
DEFINE CLASS Column1 as Column
Width=32
Sparse=.F.
Visible=.t.
PROCEDURE init
this.RemoveObject("Text1")
this.AddObject("img0", "image")
this.AddObject("img1", "image")
this.img0.Picture = "d:\temp\test_0.ico"
this.img1.Picture = "d:\temp\test_1.ico"
* 切换 Column 的 CurrentControl
this.DynamicCurrentControl = [IIF(RECNO("tt")==thisform.grd.icoIndex,"img0","img1")]
ENDPROC
ENDDEFINE