Главная страница
    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
7-86197
Eduard_
2002-10-22 10:16
2002.12.26
Active Directory Services


14-86147
Majk
2002-12-06 11:49
2002.12.26
списки


1-85935
delpher_gray
2002-12-08 15:04
2002.12.26
Почему неполучается получить кэш. пароли из конс-го приложения ?


1-86011
Acorus
2002-12-16 14:20
2002.12.26
Помогите с деревом :)


3-85782
Vick
2002-12-05 10:09
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
Английский Французский Немецкий Итальянский Португальский Русский Испанский