Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2002.12.26;
Скачать: [xml.tar.bz2];

Вниз

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;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.007 c
14-86075
Треугольник
2002-12-04 04:37
2002.12.26
Помогите кто может ....


1-85995
Kac
2002-12-16 10:44
2002.12.26
Проверка пароля


1-85953
Alexey1917
2002-12-15 14:37
2002.12.26
RGB палитра


3-85792
Dbrf
2002-12-05 10:46
2002.12.26
Выбор столбца из таблицы


1-85952
Павел
2002-12-15 14:20
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
Английский Французский Немецкий Итальянский Португальский Русский Испанский