$INCLUDE "RAPIDQ.INC"

DECLARE SUB DrawCell (Col%, Row%, State%, Rect AS QRect, Sender AS QStringGrid)

CREATE Form AS QForm
    Caption = "Check Grid"
        Width =    400
        Height =   300
    CREATE Grid AS QStringGrid
        Align = alClient
        RowCount = 11
        AddOptions(goEditing,  goColSizing ) ''goThumbTracking,
        ColWidths(0) = 25
        ColWidths(4) = 25
        DefaultRowHeight = 20
        OnDrawCell = DrawCell
        FixedColor=clGreen
        GridLineWidth=1
''        visible=0
    END CREATE

    Center
END CREATE

z=Grid.ColCount-1
dim HdButton (z) as QButton'' QCoolBtn

for i=0 to Grid.ColCount-1
HdButton(i).Parent=Form
HdButton(i).Top=Grid.Top+2'
HdButton(i).Height=Grid.RowHeights(i)'
HdButton(i).Caption=str$(i)+str$(i)+str$(i)+str$(i)
next i

Form.ShowModal

SUB DrawCell (Col%, Row%, State%, Rect AS QRect, Sender AS QStringGrid)

if  Rect.Left>=0 then
HdButton(Col%).Left=Rect.Left+3'
'print "Rect.Left"+str$(Col%)+"=",Rect.Left
HdButton(Col%).Width=Rect.Right-Rect.Left-1 '
else
HdButton(Col%).Left=0
HdButton(Col%).Width=0
end if
END SUB
'---------------------------
