社区
Delphi
帖子详情
在stringgrid里如何把一个控件嵌入cell里
zhmf
2002-07-17 11:56:23
在stringgrid里如何把一个控件嵌入cell里
如:把一个edit放到stringgrid的cell[2,1]
...全文
53
2
打赏
收藏
在stringgrid里如何把一个控件嵌入cell里
在stringgrid里如何把一个控件嵌入cell里 如:把一个edit放到stringgrid的cell[2,1]
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
sean2000
2002-07-17
打赏
举报
回复
unit Unit1;
interface
uses
Windows, Messages,stdctrls, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
end;
var
Form1: TForm1;
i,j:integer;
var testcombo:Tcombobox;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
testcombo:=Tcombobox.create(self);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
testcombo.Free;
end;
procedure TForm1.StringGrid1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
i:=x div stringgrid1.defaultcolwidth;
j:=y div stringgrid1.defaultrowheight;
testcombo.parent:=self;
testcombo.left:=stringgrid1.left+i*(stringgrid1.defaultcolwidth+2);
testcombo.top:=stringgrid1.top+j*(stringgrid1.defaultrowheight+2);
testcombo.width:=stringgrid1.DefaultColWidth;
testcombo.Height:=stringgrid1.gridHeight;
testcombo.font:=stringgrid1.font;
testcombo.Items.Clear;
testcombo.text:='未知';
testcombo.Items.add('1111');
testcombo.Items.add('2222');
testcombo.Items.add('3333');
testcombo.Items.add('4444');
end;
end.
netlib
2002-07-17
打赏
举报
回复
动态或静态创建一个,
运行时候调整它的parent、top、left、visibled来决定是否显示以及显示的位置。
在
String
Grid
中每行添加
一个
选择框(checkbox)
在网页中经常有类似的应用,例如在电子邮箱
里
,显示邮件的每一行都有
一个
选择框,用户可以对多个邮件同时做删除,移动的操作。 在delphi的
String
Grid
中虽然没有直接提供在每一行插入
一个
checkbox的功能,可是...
在Delphi XE的T
String
Grid
中使用TComboBox作为单元格编辑器
需要进行以下几步: 创建
String
Grid
,在OnSelect
Cell
事件中显示ComboBox覆盖单元格作为编辑器 创建ComboBox,将其Parent设置为
String
Gri...
TAdv
String
Grid
控件
使用技巧[转]
本文简单的介绍了TAdv
String
Grid
控件
的一些常用的属性事件和方法,主要用于统计数据和设计比较复杂的表格!核心部分:合并单元格的几个函数和过程! 1.可否进行编辑 设置Options中goEditing设置为true。 2.点击鼠标...
如何在T
String
Grid
中加入TComboBox TCheckBox
int height = DrawText(
String
Grid
1->Canvas->Handle,PAnsiChar(str.c_str()),str.Length(),&tmprect,DT_CALCRECT|DT_WORDBREAK); if (
String
Grid
1->RowHeights[ARow] ){ //Rect.Bottom = Rect.Top + height+5; ...
Adv
String
Grid
使用方法(一)
本文简单的介绍了TAdv
String
Grid
控件
的一些常用的属性事件和方法,主要用于统计数据和设计比较复杂的表格!核心部分:合并单元格的几个函数和过程! 1.可否进行编辑 设置Options中goEditing设置为true。 2...
Delphi
5,386
社区成员
262,729
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章