Posted by robert on September 13, 2005 I need write the numbers of rows in the first column of a string grid like in a spreadsheet I use the following piece of Delphi code to write floats in the other columns but i don't know how write integers. if Grid.Cells[ACol,ARow] <> '' then begin bEsNum := True; sCad := Grid.Cells[ACol,ARow]; for i:=1 to length(sCad) do //1 if not (sCad[i] in ['0'..'9','-',',']) then bEsNum := False; if bEsNum then begin sCad := Format('%10.2f',[StrToFloat(Grid.Cells[ACol,ARow])]); with Grid.Canvas,Rect do begin i := Right-TextWidth(sCad+' '); Grid.Canvas.FillRect(Rect); Grid.Canvas.TextOut(i,Top+2,sCad); end; end; end; thank you Related Articles and Replies
|