Also you using col and row varaible as global I think change to like as : g_col , g_row :Integer;
No, the Col and Row are surrounded by "with StringGrid1 do" so they are properties of StringGrid1.Ah, you already corrected that
I still haven't heard what's actually the issue. It works fine here.
Besides that the definition of
procedure TfrmMain.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
is different when you create the event in Lazarus (Rect is aRect and State is aState).
Did you just copy in the source and hoped it worked or did you really connect the procedures StringGrid1DrawCell() etc to the event-handlers in the object inspector ??