Вниз
Скачать: CL | DM;

StringGrid   Найти похожие ветки 

 
FDel   (2002-12-16 13:04) [0]

Как отцентровать содержимое ячейки по правому краю. Если можно примерчик (он целс драв и т.д.)


 
Skier ©   (2002-12-16 13:09) [1]

>FDel
Событие OnDrawCell должно помочь...


 
FDel   (2002-12-16 13:14) [2]

Так то понятно ONDRAWCEll. Так а дальше, что перерисовывать или...


 
Sha ©   (2002-12-16 20:13) [3]

Вот выкусил из работающей проги, много чего порезал, но вроде должно работать:

procedure TForm1.gDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
s: string;
Skip: integer;
begin;
if (Sender is TStringGrid) then with TStringGrid(Sender) do begin;
Canvas.Font:=Font;

if ... then Canvas.Font.Color:=clRed
else Canvas.Font.Color:=clNavy;

if ... then Canvas.Brush.Color:=clYellow;

s:=Cells[ACol, ARow];
if (s="") or (aCol<=2) then Skip:=2
else Skip:=Rect.Right-Rect.Left-Canvas.TextWidth(s)-2;
Canvas.TextRect(Rect, Rect.Left+Skip, Rect.Top+2, s);
end;
end;


 
Groove ©   (2002-12-17 07:06) [4]

Буду краток:(с)Путин
используй StringAlignGrid.


 
Anatoly Podgoretsky ©   (2002-12-17 07:45) [5]

procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
var
TempPString:Array [0..255] of char;
begin
If (gdFixed in State){or (gdSelected in State)} then exit;

(* Make changes to this to change colors of cells

StringGrid1.Canvas.Brush.Style:=bsSolid;
{You could add some color here, if desired:}
Case Col of
1: StringGrid1.Canvas.Brush.Color:=clRed;
2: StringGrid1.Canvas.Brush.Color:=clWhite;
3: StringGrid1.Canvas.Brush.Color:=clBlue;
end;*)

{Erase data, Note: if you don"t do this, it will draw
several times on the canvas and look nasty!}

StringGrid1.Canvas.FillRect(Rect);

{Get text in a PChar string}
StrPCopy(TempPString,StringGrid1.Cells[Col,Row];);

{Check to see if less than 1. You will need to change this to
cathc all your real numbers}
if StrToFloat(StringGrid1.Cells[Col,Row];) < 1 then
begin
DrawText(StringGrid1.Canvas.Handle,TempPString,-1,Rect,DT_RIGHT);
end
else
DrawText(StringGrid1.Canvas.Handle,TempPString,-1,Rect,DT_LEFT);
end;



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.009 c
3-85819
newe
2002-12-06 09:19
2002.12.26
Как мне узнать количество строчек в DBGrid е?


1-85932
eLVik
2002-12-17 15:03
2002.12.26
Цвет фона ячейки в StringGrid


14-86184
Zhirnov Maxim
2002-12-07 13:23
2002.12.26
Версия СТЭМа ФАИТ песни Belle из оперы Noterdam-De-Pari


1-85944
бобёр
2002-12-17 16:43
2002.12.26
array


14-86146
Anatoly Podgoretsky
2002-12-06 07:37
2002.12.26
Именинники 6 декабря




   Наверх