第一步:
设置cxgrid的属性, OptionsView.Indicator = True
第二步:
写OnCustomDrawIndicatorCell方法
procedure TForm1.cxGrid1DBTableView1CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
var
FValue: string;
FBounds: TRect;
begin
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
begin
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
FBounds := AViewInfo.Bounds;
ACanvas.FillRect(FBounds);
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
InflateRect(FBounds, -1, -1);
ACanvas.Font.Color := clBlack;
ACanvas.Brush.Style := bsClear;
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
ADone := True;
end;
end;
博客介绍了CXGrid相关操作的两个步骤。一是设置CXGrid的属性,将OptionsView.Indicator设为True;二是编写OnCustomDrawIndicatorCell方法,属于信息技术中前端开发相关内容。
1891

被折叠的 条评论
为什么被折叠?



