
09.08.2011, 11:28
|
Прохожий
|
|
Регистрация: 08.08.2011
Адрес: Воронеж
Сообщения: 14
Версия Delphi: 2006,7,10
Репутация: 10
|
|
Все вот отличное решение:
Код:
procedure Form.StringGridDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
var i:integer;
begin
with StringGrid,StringGrid.Canvas do
begin
if (FixedRows=0)and(ARow=0) then
begin
Brush.Color:= clBtnFace;
FillRect(Rect);
Pen.Color:= clBackground;
Brush.Style:= bsClear;
Rectangle(Rect.Left-1,Rect.Top-1,Rect.Right+1,Rect.Bottom+1);
Pen.Color:= clBtnShadow;
MoveTo(Rect.Left+1,Rect.Bottom-1);
LineTo(Rect.Right-1,Rect.Bottom-1);
LineTo(Rect.Right-1,Rect.Top);
Pen.Color:= clBtnHighlight;
MoveTo(Rect.Right-1,Rect.Top);
LineTo(Rect.Left,Rect.Top);
LineTo(Rect.Left,Rect.Bottom);
end;
if((GetWindowlong(FileGr.Handle,GWL_STYLE)and WS_VSCROLL)=0)
and(ColWidths[5]<113) then for i:=0 to 5 do ColWidths[i]:=ColWidths[i]+3;
if((GetWindowlong(FileGr.Handle,GWL_STYLE)and WS_VSCROLL)<>0)
and(ColWidths[5]>113) then for i:=0 to 5 do ColWidths[i]:=ColWidths[i]-3;
FillRect(Rect);
DrawText(Handle,PChar(Cells[ACol,ARow]),length(Cells[ACol,ARow]),Rect,
DT_CENTER or DT_VCENTER or DT_SINGLELINE);
end;
end;
procedure Form.StringGridSelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
begin
with StringGrid do
begin
if Arow=0 then
begin
CanSelect:=false;
Options:=Options-[goRangeSelect]-[goDrawFocusSelected];
end else
Options:=Options+[goRangeSelect]+[goDrawFocusSelected];
end;
end;
__________________
Код:
ShowMessage('HelloWorld!');
|