社区
Delphi
帖子详情
关于stringGrid的疑问
肥仔胧
2004-08-30 09:06:26
请问如何在stringGrid重实现打勾,也就是说,我想在其某列上实现一个Boolean型的列
类似于checkBox的功能;(非dbgrid)
...全文
209
9
打赏
收藏
关于stringGrid的疑问
请问如何在stringGrid重实现打勾,也就是说,我想在其某列上实现一个Boolean型的列 类似于checkBox的功能;(非dbgrid)
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
eagle_2
2004-08-31
打赏
举报
回复
stringgrid中嵌套一个checkbox控件不就得了,还能得到很多属性和事件呢
checkbox1.left:=stringgrid1.cellrect[].left;
checkbox1.top:=stringgrid1.cellrect[].top;
checkbox1.height:=stringgrid1.cellrect[].height;
checkbox1.width:=stringgrid1.cellrect[].width;
再在每次重绘时记得:checkbox1.caption:=stringgrid1.cells[]一下
eagle_2
2004-08-31
打赏
举报
回复
stringgrid中嵌套一个checkbox控件不就得了,还能得到很多属性和事件呢
checkbox1.left:=stringgrid1.cellrect[].left;
checkbox1.top:=stringgrid1.cellrect[].top;
checkbox1.height:=stringgrid1.cellrect[].height;
checkbox1.width:=stringgrid1.cellrect[].width;
梅青松
2004-08-30
打赏
举报
回复
用两个图片:一个打勾,一个不打勾
将图片画在stringgrid 中
在onclick事件中切换两个图片即可
肥仔胧
2004-08-30
打赏
举报
回复
应该来说说话啊
有不同的方法,大家拿来相互学习嘛
rcaicc
2004-08-30
打赏
举报
回复
学习。。。。
capoatguitar
2004-08-30
打赏
举报
回复
溜达溜达不说话
luke5678
2004-08-30
打赏
举报
回复
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids;
type
TForm1 = class(TForm)
grid: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure gridDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure gridClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
fcheck,fnocheck:tbitmap;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
i:SmallInt;
bmp:TBitmap;
begin
FCheck:= TBitmap.Create;
FNoCheck:= TBitmap.Create;
bmp:= TBitmap.create;
try
bmp.handle := LoadBitmap( 0, PChar(OBM_CHECKBOXES ));
With FNoCheck Do Begin
width := bmp.width div 4;
height := bmp.height div 3;
canvas.copyrect( canvas.cliprect, bmp.canvas, canvas.cliprect );
End;
With FCheck Do Begin
width := bmp.width div 4;
height := bmp.height div 3;
canvas.copyrect(
canvas.cliprect,
bmp.canvas,
rect( width, 0, 2*width, height ));
End;
finally
bmp.free
end;
end;
procedure TForm1.gridDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if not (gdFixed in State) then
with TStringGrid(Sender).Canvas do
begin
brush.Color:=clWindow;
FillRect(Rect);
if Grid.Cells[ACol,ARow]='yes' then
Draw( (rect.right + rect.left - FCheck.width) div 2,
(rect.bottom + rect.top - FCheck.height) div 2,
FCheck )
else
Draw( (rect.right + rect.left - FCheck.width) div 2,
(rect.bottom + rect.top - FCheck.height) div 2,
FNoCheck );
end;
end;
procedure TForm1.gridClick(Sender: TObject);
begin
if grid.Cells[grid.col,grid.row]='yes' then
grid.Cells[grid.col,grid.row]:='no'
else
grid.Cells[grid.col,grid.row]:='yes';
end;
end.
wofan
2004-08-30
打赏
举报
回复
郁闷个啥
在COL(0)里面打勾不就得
肥仔胧
2004-08-30
打赏
举报
回复
心情极度郁闷
String
Grid
使用教程(Delphi)
这篇博客详细介绍了如何在Delphi中使用
String
Grid
进行行列的插入和删除操作,并展示了如何创建具有复选框功能的列。此外,还讲解了如何实现
String
Grid
中单元格的内容分行显示、只读列的制作以及单元格对齐方式的设置。同时,提供了保存和加载
String
Grid
数据到文件的方法,以及如何通过回车键模拟Tab键切换单元格。最后,文章还讨论了如何获取
String
Grid
内容为字符串、按列排序、设置单元格对齐和在
String
Grid
中使用组合框作为自定义编辑器的方法。
String
Grid
的一些操作
本文介绍了 Delphi 中
String
Grid
控件的高级使用技巧,包括行列的增删、实现单元格检查功能、内容分行显示、制作只读列、从文本文件读写数据等功能。此外还提供了实现分页显示、打印、行列合并等复杂功能的代码示例。
delphi
String
Grid
单击表头进行高速排序
该博客主要围绕Delphi中
String
Grid
单击表头进行高速排序展开。给出了排序函数Quicksort和Sort
grid
的具体实现,可按字符、整型、浮点型排序。还包含了表格绘制、初始化及鼠标单击表头触发排序等相关代码,实现了
String
Grid
的排序功能。
气愤的
String
Grid
博客展示了一段代码,代码中对
String
Grid
的单元格赋值并尝试显示其内容,但在特定位置赋值后显示内容时却无法看到,提出是否是
STRING
GRID
存在问题。
取
string
grid
数据
本文介绍了一种通过DLL注入和消息处理技巧来Hook其他程序中的
String
Grid
组件内容的方法,并解决了跨进程获取实例的问题。
Delphi
5,943
社区成员
262,942
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章