我想在LISTVIEW中的某一个网格里放俩个时间控件,一个DateTimePicker选择日期,另外一个DateTimePicker选择时间,然后我要将日期和时间组合成一个字符串保存到数据表里,所以该字段不可以是DATETIME类型,因为这个字段的长度超出了8,要既显示日期又要显示时间。我不知道如何将DateTimePicker控件放在LISTVIEW上,请大家帮忙,谢谢。
解决方案 »
- 请教:DBSumList控件怎么用? DBGRIDEh中某字段的合计数,如何显示在DBGRIDEh控件外?而不是在footer区
- 怪问题, 为什么 我写的数据库例子程序,要运行两次才能成功连接到网络数据库,这是为什么?
- C++结构中的union在delphi中对应什么?高手进
- Delphi7中怎样保持住在画布上画的图形?
- 怎樣打印指定頁
- 请教一个简单的关于dbgrid控件的问题
- 菜鸟提问:程序打包发布问题(sql server 2000+bde+多层) 使用installshield express
- 高分求助:Delphi数据库程序在运行期间产生del*.db的问题
- 各位,请指教
- 不知道大家注意到没有,Delphi 5.0比4.0更容易死机!
- 请问,delphi中怎样将统计结果用直方图显示出来?
- 关于使用条型码的问题
begin
DateTimePicker1.Left:=0;
DateTimePicker1.Top:=0;
DateTimePicker1.Parent:=ListView1;
end;
否则有可能看不到。
首先在dbgrid上放一个DateTimePicker控件,设置visible为false。
如有不明白 QQ 120861370
//dd 是DateTimePicker控件
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if (gdFocused in State) then
begin
if column.Field.FieldName='datetime' then
begin
dd.Left := Rect.Left + DBGrid1.Left + 1;
dd.Top := Rect.Top + DBGrid1.Top + 1;
dd.Width := Rect.Right - Rect.Left + 2;
dd.Height := Rect.Bottom - Rect.Top + 2;
dd.Visible:=true;
end;
end;
end;
//改写数据库
procedure TForm1.ddChange(Sender: TObject);
begin
if DBGrid1.DataSource.State in [dsEdit, dsInsert] then
begin
dd.Time:=time;
ADOTable1.FieldByName('datetime').Value := dd.DateTime;
end;
end;
一般是选中哪一行就在哪一行显示出TDATETIMEPICKER控件,提供选择后隐藏...