DECLARE SUB CDrawCell (Col%, Row%, State%, Rect AS QRECT, Sender AS QSTRINGGRID)
DECLARE FUNCTION GetFocus LIB "user32" ALIAS "GetFocus"() AS LONG
CREATE Form AS QFORM
CAPTION = "Form1"
Width = 385
Height = 337
Center
CREATE StringGrid1 AS QSTRINGGRID
Left = 19
Top = 10
Height = 128
Width = 336
ondrawcell=CDrawCell
END CREATE
CREATE StringGrid2 AS QSTRINGGRID
Left = 22
Top = 157
Height = 136
Width = 328
TabOrder = 9
ondrawcell=CDrawCell
END CREATE
END CREATE
DIM CGrid (0 TO 100 , 0 TO 100) AS LONG
StringGrid2.cell (2 , 2)="3"
Form.SHOWMODAL
SUB CDrawCell (Col%, Row%, State%, Rect AS QRECT, Sender AS QSTRINGGRID)
IF sender.col=col% AND sender.row=row% THEN
IF getfocus()=sender.handle THEN
c=RGB(150,250,150)
ELSE
c=RGB(200,200,200)
END IF
Sender.fillrect(Rect.left, Rect.Top, Rect.right, Rect.bottom, c)
Sender.TextOut (Rect.left+1, Rect.Top+1 ,Sender.Cell(Col%, Row%), 0, -1)
END IF
END SUB
|