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


TIWGrid 所在单元及继承链:
IWCompGrids.TIWGrid

主要成员:


property Cell[const ARow: Integer, 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 IWCompGridCommon
property Caption: TCaption //
property CellPadding: Integer //单元格内边距
property CellSpacing: Integer //单元格间距
property Font: TIWFont //如果各单元格字体一直, 可以在这里一起指定
property FrameBuffer: Integer //?
property Lines: TIWGridLines //对应 Table 的 Rules 属性: tlAll、tlNone、tlRows、tlCols
property Summary: string //对应 Table 的 summary 属性
property UseFrame: Boolean //是否使用框架, 在需要时它会给出滚动条
property UseSize: Boolean //是否使用设计时的大小; 好像只对宽度有用
property CurrentRow: Integer //如果 ScrollToCurrentRow = True, 可通过 CurrentRow 让指定行立即可见
property ScrollToCurrentRow: Boolean //参见 CurrentRow
property 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

测试:

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;

效果图:


使用 IntraWeb (20) - 基本控件之 TIWGrid的更多相关文章

  1. 使用 IntraWeb (22) - 基本控件之 TIWCalendar

    TIWCalendar: 日历控件, 继承于 TIWCustomGrid, 所以它和 TIWGrid 共同属性特多. 它的 Cell 是 TIWCalendarCell 对象, 直接从 TIWGrid ...

  2. 使用 IntraWeb (24) - 基本控件之 TIWFileUploader、TIWFile

    TIWFileUploader 是基于 Ajax 的上传控件, 最初是 Andrew Valums 开发, 从 IntraWeb XIV 纳入并替换 TIWFile. 虽然从组件面板上还能看到 TIW ...

  3. 使用 IntraWeb (29) - 基本控件之 TIWAutherList、TIWAutherINI、TIWAutherEvent

    TIWAutherList //通过一组户名与密码验证登陆 TIWAutherINI //通过记录户名与密码信息的 #Auth.ini 文件验证登陆 TIWAutherEvent //通过其 OnCh ...

  4. 使用 IntraWeb (28) - 基本控件之 TIWTemplateProcessorHTML、TIWLayoutMgrHTML、TIWLayoutMgrForm

    TIWTemplateProcessorHTML //使用外部的 html 文件做模板 TIWLayoutMgrHTML //直接输入 Html 文本做模板 TIWLayoutMgrForm //这应 ...

  5. 使用 IntraWeb (26) - 基本控件之 TIWMenu

    TIWMenu 的任务是让原来的 TMainMenu 呈现在网页上, 通过其 AttachedMenu 属性关联一个 TMainMenu 是必需的. TIWMenu 所在单元及继承链: IWCompM ...

  6. 使用 IntraWeb (25) - 基本控件之 TIWRegion

    这应该是 IW 中最重要的容器了, 和它同父的还有 TIWTabControl TIWRegion 所在单元及继承链: IWRegion.TIWRegion 主要成员: property Align: ...

  7. 使用 IntraWeb (23) - 基本控件之 TIWTimer、TIWProgressBar、TIWProgressIndicator、TIWTimeEdit

    TIWTimer //和 TTimer 没多大区别, 它的默认事件现在是异步的(OnAsyncTimer), 在网络上使用 OnTimer 肯定是非常糟糕的 TIWProgressBar //进度条 ...

  8. 使用 IntraWeb (19) - 基本控件之 TIWTreeView

    这是个饱受非议的控件; 我通过尝试, 理解了非议, 也能理解作者. 总之向作者的思路靠拢吧, 还是不错的. TIWTreeView 所在单元及继承链: IWCompTreeview.TIWTreeVi ...

  9. 使用 IntraWeb (16) - 基本控件之 TIWList、TIWListbox、TIWComboBox、TIWOrderedListbox

    TIWList //列表; 它对应 Html 中的 OL.LI(某些选项下会用表格模拟); TIWListbox 和 TIWComboBox 则对应 Html 在的 Option TIWListbox ...

随机推荐

  1. .NET面试题系列(五)数据结构(Array、List、Queue、Stack)及线程安全问题

    常用数据结构的时间复杂度 如何选择数据结构 Array (T[]) 当元素的数量是固定的,并且需要使用下标时. Linked list (LinkedList<T>) 当元素需要能够在列表 ...

  2. ASP.net 控件实现数据级联

    今天我们来一起用ASP.net实现一个级联,这个小不点应该是会经常用到的的. 咱们简单的画两个窗体.文本框会根据下拉框所选的内容显示不同的内容. 具体实现效果如下 步骤一: 准备工作,建立相应的数据库 ...

  3. CF11D A Simple Task(状压DP)

    \(solution:\) 思路大家应该都懂: 状压DP:\(f[i][j]\),其中 \(i\) 这一维是需要状压的,用来记录19个节点每一个是否已经走过(走过为 \(1\) ,没走为 \(0\) ...

  4. Python学习三|列表、字典、元组、集合的特点以及类的一些定义

    此表借鉴于他人 定义 使用方法 列表 可以包含不同类型的对象,可以增减元素,可以跟其他的列表结合或者把一个列表拆分,用[]来定义的 eg:aList=[123,'abc',4.56,['inner', ...

  5. python 搭建http服务器和ftp服务器

    默认安装版本为pytho2.7 http服务器搭建: 进入要开放访问的目录下,执行命令:python -m SimpleHTTPServer 9000 显示上述表示安装成功,且http服务的端口为:9 ...

  6. centos7更改网卡名

    虚拟机中安装centos7,分配两张网卡,安装完成后,使用ip addr 命令查看网卡,发现网卡名称为ens33 和 ens34,不符合平时的使用习惯,想把网卡名改为eth0和eth1,具体操作步骤如 ...

  7. SpringBoot修改默认端口号,session超时时间

    有时候我们可能需要启动不止一个SpringBoot,而SpringBoot默认的端口号是8080,所以这时候我们就需要修改SpringBoot的默认端口了.修改SpringBoot的默认端口有两种方式 ...

  8. C#实现语音朗读功能

    第一步:新建项目  TTS(从文本到语音(TextToSpeech)) 第二步:添加引用 System.Speech 第三步:主界面以及后台代码 using System;using System.G ...

  9. (转)Python函数式编程——map()、reduce()

    转自:http://www.jianshu.com/p/7fe3408e6048 1.map(func,seq1[,seq2...]) Python 函数式编程中的map()函数是将func作用于se ...

  10. nodejs乱码处理

    1.处理回显乱码 res.write("<head><meta charset='utf-8'></head>"); 2.处理传参乱码 quer ...