使用 IntraWeb (20) - 基本控件之 TIWGrid
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的更多相关文章
- 使用 IntraWeb (22) - 基本控件之 TIWCalendar
TIWCalendar: 日历控件, 继承于 TIWCustomGrid, 所以它和 TIWGrid 共同属性特多. 它的 Cell 是 TIWCalendarCell 对象, 直接从 TIWGrid ...
- 使用 IntraWeb (24) - 基本控件之 TIWFileUploader、TIWFile
TIWFileUploader 是基于 Ajax 的上传控件, 最初是 Andrew Valums 开发, 从 IntraWeb XIV 纳入并替换 TIWFile. 虽然从组件面板上还能看到 TIW ...
- 使用 IntraWeb (29) - 基本控件之 TIWAutherList、TIWAutherINI、TIWAutherEvent
TIWAutherList //通过一组户名与密码验证登陆 TIWAutherINI //通过记录户名与密码信息的 #Auth.ini 文件验证登陆 TIWAutherEvent //通过其 OnCh ...
- 使用 IntraWeb (28) - 基本控件之 TIWTemplateProcessorHTML、TIWLayoutMgrHTML、TIWLayoutMgrForm
TIWTemplateProcessorHTML //使用外部的 html 文件做模板 TIWLayoutMgrHTML //直接输入 Html 文本做模板 TIWLayoutMgrForm //这应 ...
- 使用 IntraWeb (26) - 基本控件之 TIWMenu
TIWMenu 的任务是让原来的 TMainMenu 呈现在网页上, 通过其 AttachedMenu 属性关联一个 TMainMenu 是必需的. TIWMenu 所在单元及继承链: IWCompM ...
- 使用 IntraWeb (25) - 基本控件之 TIWRegion
这应该是 IW 中最重要的容器了, 和它同父的还有 TIWTabControl TIWRegion 所在单元及继承链: IWRegion.TIWRegion 主要成员: property Align: ...
- 使用 IntraWeb (23) - 基本控件之 TIWTimer、TIWProgressBar、TIWProgressIndicator、TIWTimeEdit
TIWTimer //和 TTimer 没多大区别, 它的默认事件现在是异步的(OnAsyncTimer), 在网络上使用 OnTimer 肯定是非常糟糕的 TIWProgressBar //进度条 ...
- 使用 IntraWeb (19) - 基本控件之 TIWTreeView
这是个饱受非议的控件; 我通过尝试, 理解了非议, 也能理解作者. 总之向作者的思路靠拢吧, 还是不错的. TIWTreeView 所在单元及继承链: IWCompTreeview.TIWTreeVi ...
- 使用 IntraWeb (16) - 基本控件之 TIWList、TIWListbox、TIWComboBox、TIWOrderedListbox
TIWList //列表; 它对应 Html 中的 OL.LI(某些选项下会用表格模拟); TIWListbox 和 TIWComboBox 则对应 Html 在的 Option TIWListbox ...
随机推荐
- 让你的HTML5&CSS3网站在老IE中也能正常显示的3种方法
起初,IE其实也是一款非常有进取心的浏览器.但经过一段时间的蛰伏后,它已经成为了我们生活中的一道障碍.微软现在又重新开始向其它浏览器发起挑战,但事实情况是,新版的现代IE浏览器一直滞后于谷歌浏览器和火 ...
- IOS 与 PHP 通信加密,使用AES 128 CBC no padding
这个网上的资料真实浩如烟海,但是真正有价值的屈指可数 自己尝试了一天多,终于还是搞定了. 再次要感谢网上的前辈么. 比如下面这个关于php和java端的实现: http://my.oschina.ne ...
- 无法在线安装Genymotion Eclipse插件,显示”There are no categoryzed items“
去掉对“Group items by category"的勾选.
- Centos6.5下升级Python版本
Cenos6.5升级Python2.6到2.7 1.下载源码包 wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz 2.进行 ...
- Linux那些事儿之我是Hub(大结局)挂起自动化【转】
转自:http://blog.csdn.net/fudan_abc/article/details/1805471 目睹了当今大学校园的素质流氓化,kiss公开化,消费白领化,上课梦游化,逃课普遍化, ...
- 走进异步编程的世界--async/await项目使用实战
起因:今天要做一个定时器任务:五分钟查询一次数据库发现超时未支付的订单数据将其状态改为已经关闭(数据量大约100条的情况) 开始未使用异步: public void SelfCloseGpPayOrd ...
- 使用@SpringBootApplication注解
很多Spring Boot开发者总是使用@Configuration , @EnableAutoConfiguration 和 @ComponentScan 注解他们的main类. 由于这些注解被如此 ...
- redis,nodejs,php,pub/sub 实战: 微信语音识别
2015年5月22日 20:20:20 星期五 效果: 这边对微信说话, 浏览器端及时显示语音识别的文字 注意: 在连接socket.io时, 按下浏览器f12, 如果一直有请求不断的刷, 说明so ...
- poj2679
题意:给出一个有向图,每条边有两个属性:一个长度一个费用.费用可能是负数.长度一定是非负的.给出一个起点和一个终点,现要求,从起点走到终点,且从每个点走出时选择的那条边必须是以该点作为起点的边中费用最 ...
- Java 基本语法---Java运算符
Java 基本语法---Java运算符 0. 概述 Java中的运算符主要分为以下几种: 算术运算符 赋值运算符 关系运算符 逻辑运算符 条件运算符 位运算符 其他运算符 1. 算术运算符 操作符 描 ...