Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.04.25;
Скачать: CL | DM;

Вниз

Как изменить цвет выделеной ячейки в StringGrid ?   Найти похожие ветки 

 
MAXH0 ©   (2004-04-08 23:56) [0]

subj


 
GanibalLector ©   (2004-04-09 01:08) [1]

procedure TFrame2.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
 Rect: TRect; State: TGridDrawState);
begin
with stringgrid1.Canvas do begin
if (Acol<>0) and (Arow<>0)  then begin
FillRect(Rect);
Font.Color := clblack;
Brush.Color := clwhite;
if textwidth(Stringgrid1.cells[Acol,Arow])>=Rect.Right-Rect.Left then
textout(rect.left+2,Rect.top+4,stringgrid1.Cells[Acol,Arow]) else
textout(rect.left+(rect.right-rect.left -
textwidth(stringgrid1.cells[Acol,Arow])) div 2 ,
Rect.top+4,stringgrid1.Cells[Acol,Arow]);
                          end else
begin
Brush.Color := clbtnface;
//Font.Style:=[fsBold]; //&#239;&#238;&#230;&#232;&#240;&#237;&#229;&#229;!
FillRect(Rect);
Font.Color := clblack;
// &#237;&#243; &#242;&#243;&#242; &#239;&#240;&#224;&#226;&#228;&#224; &#225;&#229;&#231; &#239;&#240;&#238;&#226;&#229;&#240;&#234;&#232; &#231;&#224; &#226;&#251;&#245;&#238;&#228; &#227;&#240;&#224;&#237;&#232;&#246;&#251;!!!
// &#242;.&#234;. &#243; &#236;&#229;&#237;&#255; &#242;&#224;&#236; &#242;&#238;&#235;&#252;&#234;&#238; &#246;&#232;&#244;&#240;&#251;! &#197;&#241;&#235;&#232; &#234;&#238;&#236;&#243; &#237;&#224;&#228;&#238;,&#242;&#238; &#241;&#236;.&#239;&#240;&#232;&#236;&#229;&#240; &#237;&#232;&#230;&#229; &#232;&#235;&#232; &#226;&#251;&#248;&#229;!
textout(rect.left+(rect.right-rect.left -textwidth(stringgrid1.cells[Acol,Arow])) div 2  , Rect.top+4,stringgrid1.Cells[Acol,Arow]);
                          end;
if  gdselected in state then begin
Brush.Color := $cbe08b;
FillRect(Rect);
Font.Color := clblack;
if textwidth(Stringgrid1.cells[Acol,Arow])>=Rect.Right-Rect.Left
then textout(rect.left+2 ,Rect.top+4,stringgrid1.Cells[Acol,Arow]) else
textout(rect.left+(rect.right-rect.left -
textwidth(stringgrid1.cells[Acol,Arow])) div 2 ,
Rect.top+4,stringgrid1.Cells[Acol,Arow]);
                               end;
                           end; end;
НАСЛОЖДАЙСЯ!!!


 
RDen   (2004-04-09 07:49) [2]

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
 Rect: TRect; State: TGridDrawState);

begin
  TStringGrid(Sender).Canvas.Font.Color := clWindowText;
  IF gdSelected IN State Then
    begin
      TStringGrid(Sender).Canvas.Brush.Color := $00A2C9F4;//clSkyBlue;
      TStringGrid(Sender).Canvas.FillRect(Rect);
    end;
 with TStringGrid(Sender) do
   begin
     S := Cells[ACol,ARow];
     Dec(Rect.Right, 2); Inc(Rect.Top, 2);
     Canvas.FillRect(Rect);
     DrawText(Canvas.Handle, PChar(S), Length(S), Rect, DT_LEFT);
   end
end;

так вроде попроще :)



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

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

Наверх




Память: 0.47 MB
Время: 0.038 c
6-1077011555
AlexNx
2004-02-17 12:52
2004.04.25
Indy SMTP Client and Proxy?


4-1076838918
Viktor Kushnir
2004-02-15 12:55
2004.04.25
Как загрузить через CreateProcess ярлык (*.lnk)


3-1080713031
dik
2004-03-31 10:03
2004.04.25
Разноцветный D B G R I D


8-1074095091
Profi
2004-01-14 18:44
2004.04.25
Секунды трека


11-1064908577
Yrasikombo
2003-09-30 11:56
2004.04.25
В Delphi 7 выдает ошибку "File not found: Exptlntf.dcu "