Главная страница
    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.45 MB
Время: 0.006 c
1-85924
iNew
2002-12-17 06:36
2002.12.26
Как запихать текст в ProgressBar. Lable не плдходит так, как


3-85865
Larisa
2002-12-08 20:03
2002.12.26
Подскажите пожалуйста, как сделать Back up из приложения.


4-86232
Almaz
2002-11-10 04:13
2002.12.26
Popup меню


14-86124
Slava_K
2002-12-05 09:17
2002.12.26
Пакет обновления SP для Delphi 7


3-85813
KV
2002-12-06 11:50
2002.12.26
Базы





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский