tak, det virker som det skal
"Claus Christiansen" <kruc@bigfoot.com> skrev i en meddelelse
news:Xns90F785A557518krucsid@192.168.1.2...
> "Nikolaj" <woel@worldonline.dk> wrote in
> news:3b7106be$0$252$edfadb0f@dspool01.news.tele.dk:
> > "Claus Christiansen" <kruc@bigfoot.com> skrev i en meddelelse
> > news:Xns90F6CBD95CF17krucsid@192.168.1.2...
> >> "Nikolaj" <woel@worldonline.dk> wrote in
> >> news:3b6fe6ee$0$251$edfadb0f@dspool01.news.tele.dk:
> >>
> >> > Hvordan laver med det sådan at numre starter fra højre i stringgrid?
> >> >
> >> Du skal selv skrive OnDrawCell metoden - hvis du behøver mere hjælp så
> >> bare skriv!
> >>
> > det vil jeg gerne ha' rigtigt meget hjælp til.
> >
>
> Her kommer så en OnDrawCellMetode - den kan du jo så more dig lidt med...
>
> procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow:
> Integer;
> Rect: TRect; State: TGridDrawState);
> const
> margin = 4; // Space from text to cellborder
> var
> x, y, e: integer;
> v: extended;
> s: String;
> begin
> with (Sender as TStringGrid) do // Witch sr
> begin
> s := Cells[ACol, ARow];
>
> // Calc the vert. position (middle of the cell)
> y := Rect.Top +
> (Rect.Bottom - Rect.Top - Canvas.TextHeight(Cells[Acol, Arow]))
> div 2;
>
> // Is the cells contents a legal floatvalue??
> if TextToFloat(PChar(Cells[ACol, ARow]), v, fvExtended) then
> begin
> // It is!
> s := Trim(s); // Remove leading and tailing spaces
> x := Rect.Right - Canvas.TextWidth(s) - margin;
> end
> else
> // It' not - it must be treated as text
> x := Rect.Left + margin;
>
> // Do the painting
> Canvas.TextRect(Rect, x, y, s);
> end;
> end;
>
> /Claus
>
> --
> Claus Christiansen, <mailto:cch@unipeople.dk>
>
> personal:
http://www.bigfoot.com/~kruc/; pythia:
http://www.pythia.dk
> ============================================--------------------------
> "Computers are useless. They can only give you answers."
> - Pablo Picasso (1881-1973)