[Lazarus] error in examples
Jesus Reyes
jesusrmx at yahoo.com.mx
Thu May 15 20:29:04 CEST 2008
--- Héctor Fiandor Rosario <hfiandor at infomed.sld.cu> escribió:
> Dear sirs:
>
> I have found an error in the Examples of Lazarus
>
> In the archive gridcelleditor the StringGrid'index are traslocate
>
> //StringGrid1.Cells[x,y]:=IntToStr(x)+','+IntToStr(y);
> //[Row,Col]
> StringGrid1.Cells[y,x]:=IntToStr(x)+','+IntToStr(y);
> //[Col,Row]
>
fixed, thanks.
> I am looking how to align the string in cells and how to get colors
> for
> different cells.
the easiest way is to use OnPrepareCanvas, for example in following
code cell(2,2) has a yellow background and text is right aligned at
the bottom of cell:
procedure TForm1.StringGrid1PrepareCanvas(sender: TObject; aCol,
aRow: Integer;
aState: TGridDrawState);
var
aTextStyle: TTextStyle;
begin
if (aCol=2) and (aRow=2) then begin
StringGrid1.Canvas.Brush.Color := clYellow;
aTextStyle := StringGrid1.Canvas.TextStyle;
aTextStyle.Alignment:=taRightJustify;
aTextStyle.Layout:=tlBottom;
StringGrid1.Canvas.TextStyle := aTextStyle;
end;
end;
see also: http://wiki.lazarus.freepascal.org/Grids_Reference_Page
>
> I have implemented a MultiStringGrid component in Delphi5 but I
> dont know
> how to do it in Lazarus.
I don't know MultiStringGrid can't comment on that.
>
> thanks very much
>
> yours truly,
>
> Ing. Héctor F. Fiandor
> hfiandor at infomed.sld.cu
>
Jesus Reyes A.
____________________________________________________________________________________
Yahoo! Deportes Beta
¡No te pierdas lo último sobre el torneo clausura 2008! Entérate aquí http://deportes.yahoo.com
More information about the Lazarus
mailing list