[英]How to set text alignment for a specific column in firemonkey TGrid/TStringGrid?
[英]Create readonly text column TGrid firemonkey
我从TColumn创建了自定义的Column类,并且正在像这样在单元画布上进行一些自定义绘制:
type
TCustomCol = class(TColumn)
protected
procedure DrawCell(const Canvas: TCanvas; const Row: integer; const Bounds: TRectF; const Value: TValue); override;
end;
问题是我的单元格默认情况下都是可编辑的,如果我未在网格选项中设置编辑模式,它们将是不可编辑的,但是我只希望某些单元格不可编辑。
在声明TForm / TFrame之前,可以覆盖单元中受保护的TCustomGrid.CanEdit函数:
type
TGrid = class(FMX.Grid.TGrid)
protected
function CanEdit: Boolean; override;
end;
TmyForm = class(TForm)
myGrid: TGrid;
.....
end;
implementation
....
function TGrid.CanEdit: Boolean;
begin
Result := inherited CanEdit and not ((ColumnIndex = 0) and (Selected < 2)); //use your condition
end;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.