如何设置TDrawGrid 选中时候高亮的颜色? Delphi

现在默认的是蓝色,如何修改成别的颜色
2025-04-14 02:07:59
推荐回答(2个)
回答1:

学会看Help
procedure TForm1.DrawGrid1DrawCell(Sender: TObject; Col, Row: Longint; Rect: TRect; State: TGridDrawState);

var
index: integer;
begin
index := Row * DrawGrid1.ColCount + Col;
with Sender as TDrawGrid do
begin
Canvas.Brush.Color := clBackGround;
Canvas.FillRect(Rect);
ImageList1.Draw(Canvas,Rect.Left,Rect.Top,index);
if gdFocused in State then
Canvas.DrawFocusRect(Rect);
end;

end;

回答2:

晚上给你源码