有这样一段程序:procedure Tfrm_cggl_cgjh.DBGridDetailDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if (gdfocused in state) then
begin
if Column.FieldName = 'xqrq' then //控制DateTimePicker的位置
begin
DateTimePickerXq.Visible:= true;
DateTimePickerXq.SetBounds(Rect.Left+DBGridDetail.Left+1,
Rect.Top+DBGridDetail.Top+1, Rect.Right-Rect.Left,Rect.Bottom-Rect.Top);
if Column.Field.AsString <> '' then
DateTimePickerXq.Date:= Column.Field.AsDateTime;
end;
if Column.FieldName <> 'xqrq' then
DateTimePickerXq.Visible:= false;
end;请问其中的if (gdfocused in state) 是什么意思啊?
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if (gdfocused in state) then
begin
if Column.FieldName = 'xqrq' then //控制DateTimePicker的位置
begin
DateTimePickerXq.Visible:= true;
DateTimePickerXq.SetBounds(Rect.Left+DBGridDetail.Left+1,
Rect.Top+DBGridDetail.Top+1, Rect.Right-Rect.Left,Rect.Bottom-Rect.Top);
if Column.Field.AsString <> '' then
DateTimePickerXq.Date:= Column.Field.AsDateTime;
end;
if Column.FieldName <> 'xqrq' then
DateTimePickerXq.Visible:= false;
end;请问其中的if (gdfocused in state) 是什么意思啊?
解决方案 »
- 欢迎厦门地区的朋友加入厦门程序员联盟群
- 如果用流讀取ZIP文件中指定名稱的圖片並顯示到 TImage?
- TDBLookupComboboxEh ,DBgirdEh的刷新问题(老问题)
- 高分相送,关于OCX的问题,100分相送
- 怎样让计算结果只保留两位小数点
- 300分!求ftp客户端程序,具体要求内详。(贴2)
- 通过哪个函数可以得到本机的IP地址和主机名称?在线等待,马上给分
- 如何声明一个局部静态变量?
- edit如何实现记忆功能?
- 为什么我在Form Active事件中加入的Close方法并不能关闭当前窗口?
- 关于TCxSplitter控件的问题
- 急:如何使cxdbtextedit的值不被清除??
程序片断的意思是在自绘DBGrid单元格时,如果当前要绘制的单元格处于焦点激活状态,做以下处理。
1、列字段名称是 "xqri",则自单元格显示DateTimePickerXq日期控件,日期控件的填充区域和单元格一致。
2、列字段名称不是 "xqri",则把日期控件隐藏。该功能用DBGridEh控件可以实现,即如果DBGridEh控件绑定的记录集某字段是日期类型,输入时,自动变成DateTimePicker输入方式,不需要自绘控件。
gdFocused The cell has input focus.
gdFixed The cell is in the fixed region of the grid.