cxgrid怎么实现记录序号显示,就象Execl表格最左边的记录序号显示列一样 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在TableView的CustomDrawIndicatorCell事件写代码.procedure TForm1.cxGrid1DBTableView1CustomDrawIndicatorCell( Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);var FValue: string; FBounds: TRect;begin FBounds := AViewInfo.Bounds; if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then begin ACanvas.FillRect(FBounds); ACanvas.DrawComplexFrame(FBounds, clBlack, clBlack, [bBottom, bLeft, bRight], 1); FValue :=IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index+1); InflateRect(FBounds, -3, -2); //Platform specific. May not work on Linux. ACanvas.Font.Color := clBlack; ACanvas.Brush.Style := bsClear; ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop); ADone := True; end;end; 如果是SQL SERVER的话,可以直接在SQL语句中,用IDENTITY函数(例如IDENTITY(int,1,1)),自动生成一列。 to cncharles(旺仔)非常感谢,功能已经实现了,但你画的是lfUltraFlat风格的,lfUltraFlat好难看啊,能给个画成lfFlat风格的吗? DrawComplexFame改成ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);InflateRect改成InflateRect(FBounds, -1, -1) 调用VC写的DLL出现问题~~~求救各位 delphi的TList能不能这样? 初学请教:rave能联ado数据集吗??等!!!! 请问,有谁知道那里可以免费下载1stclass4000 急!如何获取本机ftp虚拟目录对应的物理路径? Socket通讯问题,多个clientsocket连接到一个serversocket时 如何在TIdSMTP、TIdMessage中添加邮件附件? 谁知道D6 Updata pack2 升级包的密码 祝贺!妈的,终于找到工作了!up有分! 程序中用到winsock控件,能不能不安装直接在windows98下使用??? 求一控件 50分求啦 三层结构主从问题
Sender: TcxGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
var
FValue: string;
FBounds: TRect;
begin
FBounds := AViewInfo.Bounds;
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
begin
ACanvas.FillRect(FBounds);
ACanvas.DrawComplexFrame(FBounds, clBlack, clBlack, [bBottom, bLeft, bRight], 1);
FValue :=IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index+1);
InflateRect(FBounds, -3, -2); //Platform specific. May not work on Linux.
ACanvas.Font.Color := clBlack;
ACanvas.Brush.Style := bsClear;
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
ADone := True;
end;
end;
非常感谢,功能已经实现了,但你画的是lfUltraFlat风格的,lfUltraFlat好难看啊,能给个画成lfFlat风格的吗?
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
InflateRect改成
InflateRect(FBounds, -1, -1)