8288分类目录 8288分类目录 8288分类目录
  当前位置:海洋目录网 » 站长资讯 » 站长资讯 » 文章详细 订阅RssFeed

使用 IntraWeb (20) - 基本控件之 TIWGrid

来源:本站原创 浏览:139次 时间:2021-09-16
使用 IntraWeb (20) - 基本控件之 TIWGrid    


TIWGrid 最终通过 Html Table 呈现; 其每个 Cell 都是一个 TIWGridCell 对象, Cell 对象的 Control 属性非常好, 可以非常方便地嵌入其他控件.



TIWGrid 所在单元及继承链:
IWCompGrids.TIWGrid < TIWCustomGrid < TIWCustomControl < TIWBaseHTMLControl < TIWBaseControl < TIWVCLBaseControl < TControl < TComponent < TPersistent < TObject

主要成员:


property Cell[const ARow: IͨѶ,ͨ��nteger, const AColumn: Integer]: TIWGridCell //读取单元格对象property RowCount: Integer    //行数property ColumnCount: Integer //列数property ShowInvisibleRows: Boolean  //是否隐藏空行property HiddenColumns: TStringList  //隐藏指定列, 譬如: IWGrid1.HiddenColumns.CommaText := '0,2'; 是隐藏第 1、3 列property ShowEmptyCells: Boolean     //是否显示空的单元格; 好像存在点问题property BGColor: TIWColor           //property BorderColors: TIWGridBorderColors //边框色分为: 主色、暗色、亮色(Color、Dark、Light)property BorderSize: Integer               //线宽, 对应 Table 的 Border 属性property BorderStyle: TIWGridBorderStyle   //它对应 Table 的 frame 属性(边框相关); 使用具体的属性值需要 uses IWCompGridCommonproperty Caption: TCaption     //property CellPadding: Integer  //单元格内边距property CellSpacing: Integer  //单元格间距property Font: TIWFont         //如果各单元格字体一直, 可以在这里一起指定property FrameBuffer: Integer  //?property Lines: TIWGridLines   //对应 Table 的 Rules 属性: tlAll、tlNone、tlRows、tlColsproperty Summary: string       //对应 Table 的 summary 属性property UseFrame: Boolean     //是否使用框架, 在需要时它会给出滚动条property UseSize: Boolean      //是否使用设计时的大小; 好像只对宽度有用property CurrentRow: Integer         //如果 ScrollToCurrentRow = True, 可通过 CurrentRow 让指定行立即可见 property ScrollToCurrentRow: Boolean //参见 CurrentRowproperty CellRenderOptions: TIWCellRenderOptions //集合选项, 决定哪些 Cell 相关的设置会被使用: [crAlign, crBGcolor, crCellPadding, crStyle, crValign]property OnCellClick: TIWOnCellClick   //如果 TIWGridCell.Clickable = True; 单元格中的文本就会变成链接, 以响应该事件property OnRenderCell: TIWOnRenderCell //同 TStringGrid 中的 OnDrawCell, 可以在此事件中个性化单元格property OnGetCellRenderOptions: TIWGetCellRenderOptionsEvent //可以从这里设置某些单元格的 CellRenderOptions 属性procedure Clear //function CellExists(const ARow: Integer; const AColumn: Integer): Boolean //判断参数指定的单元格是否有效(譬如超界了)procedure DeleteColumn(const AColumn: Integer)  //删除列procedure DeleteRow(const ARow: Integer)        //删除行


TIWGridCell:


{IWCompGrids.TIWGridCell < TCollectionItem < TPersistent < TObject}property Grid: TIWCustomGridproperty DoRefreshControl: Booleanproperty Clickable: Boolean  //property Alignment: TAlignment  //property VAlign: TIWVerticalAlignment //property BGColor: TIWColorproperty Control: TIWCustomControl  //嵌入其他控件property DoSubmitValidation: Booleanproperty Font: TIWFontproperty Header: Booleanproperty Height: stringproperty Hint: stringproperty ShowHint: Booleanproperty Tag: TObjectproperty Text: string  //property UnlinkedText: stringproperty Visible: Booleanproperty Width: stringproperty Wrap: Boolean    //property RawText: Boolean //property Css: stringproperty Collection: TCollectionproperty ID: Integerproperty Index: Integerproperty DisplayName: string


测试:


procedure TIWForm1.IWAppFormCreate(Sender: TObject);var  i,j: Integer;begin  IWGrid1.RowCount := 5;  IWGrid1.ColumnCount := 3;  IWGrid1.Caption := 'Test Table';  IWGrid1.BGColor := $d0d0d0;  IWGrid1.CellPadding := 8;  IWGrid1.Font.Size := 12;  IWGrid1.Lines := tlCols;  for i := 0 to IWGrid1.RowCount - 1 do    for j := 0 to IWGrid1.ColumnCount - 1 do    begin      IWGrid1.Cell[i,j].Text := Format('%d, %d', [i, j]);      IWGrid1.Cell[i,j].Alignment := taCenter;//      IWGrid1.Cell[i,j].VAlign := vaMiddle;      IWGrid1.Cell[i,j].Clickable := True;      if Odd(i) then IWGrid1.Cell[i,j].BGColor := $f0f0f0;    end;  LinkColor := $0000FF;  IWGrid1.UseSize := True;end;{OnCellClick}procedure TIWForm1.IWGrid1CellClick(ASender: TObject; const ARow, AColumn: Integer);begin  WebApplication.ShowMessage(IWGrid1.Cell[ARow, AColumn].Text);end;


效果图:




  推荐站点

  • At-lib分类目录At-lib分类目录

    At-lib网站分类目录汇集全国所有高质量网站,是中国权威的中文网站分类目录,给站长提供免费网址目录提交收录和推荐最新最全的优秀网站大全是名站导航之家

    www.at-lib.cn
  • 中国链接目录中国链接目录

    中国链接目录简称链接目录,是收录优秀网站和淘宝网店的网站分类目录,为您提供优质的网址导航服务,也是网店进行收录推广,站长免费推广网站、加快百度收录、增加友情链接和网站外链的平台。

    www.cnlink.org
  • 35目录网35目录网

    35目录免费收录各类优秀网站,全力打造互动式网站目录,提供网站分类目录检索,关键字搜索功能。欢迎您向35目录推荐、提交优秀网站。

    www.35mulu.com
  • 就要爱网站目录就要爱网站目录

    就要爱网站目录,按主题和类别列出网站。所有提交的网站都经过人工审查,确保质量和无垃圾邮件的结果。

    www.912219.com
  • 伍佰目录伍佰目录

    伍佰网站目录免费收录各类优秀网站,全力打造互动式网站目录,提供网站分类目录检索,关键字搜索功能。欢迎您向伍佰目录推荐、提交优秀网站。

    www.wbwb.net