Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.12.26;
Скачать: 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 вся ветка

Текущий архив: 2002.12.26;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.011 c
14-86117
MaximatorVeter
2002-11-27 22:35
2002.12.26
30 таблеток нитроглицирина и 10 снотворного (не знаю какого)


1-85920
___Nikolay
2002-12-15 14:35
2002.12.26
DBGRID с фиксированным столбцом


14-86097
D-NICKNAME
2002-12-03 23:20
2002.12.26
Сочетание клавиш.


4-86220
KUZIA
2002-11-12 13:10
2002.12.26
Как написать скринсавер


14-86173
Дмитрий К.К.
2002-12-06 16:12
2002.12.26
Шаблоны HTML-страниц для сайта