回复 19楼 laowan001
没错,换成这个就简单多了,谢谢指导。
2022-12-04 11:04
2022-12-04 11:07
2022-12-04 12:30
2022-12-05 07:23
2022-12-05 07:24
2022-12-06 18:43
[此贴子已经被作者于2022-12-7 13:53编辑过]
2022-12-07 13:46
2022-12-07 15:48
2022-12-07 17:04
程序代码:
PROCEDURE AfterRowColChange(nColIndex)
IF this.RowColChange == 1
this.index = RECNO()
this.SetFocus
ENDIF
ENDPROC
PROCEDURE BackStyle_ACCESS
this.Picture = IIF(RECNO("tt")==thisform.grd.index,"d:\temp\test_0.ico","d:\temp\test_1.ico")
RETURN THIS.BackStyle
ENDPROC
程序代码:
CREATE CURSOR tt (img v(1), f1 v(10))
FOR i=1 TO 9
INSERT INTO tt VALUES ("", REPLICATE(TRANSFORM(i),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
index = 1
PROCEDURE init
this.Column1.width=32
this.Column1.RemoveObject("Text1")
this.Column1.AddObject("img", "grdimg")
this.Column1.Sparse = .F.
ENDPROC
PROCEDURE AfterRowColChange(nColIndex)
IF this.RowColChange == 1
this.index = RECNO()
this.SetFocus
ENDIF
ENDPROC
ENDDEFINE
DEFINE CLASS grdimg AS image
BackStyle = 0
Width = 32
Height = 32
Stretch = 0
PROCEDURE BackStyle_ACCESS
this.Picture = IIF(RECNO("tt")==thisform.grd.index,"d:\temp\test_0.ico","d:\temp\test_1.ico")
RETURN THIS.BackStyle
ENDPROC
ENDDEFINE
2022-12-07 19:43