爱
爱上猫的鱼
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if(gdFocused in State) then // gdFocused in State是什么意思
begin
if(Field.FieldName=DBComboBox1.DataField) then//DBComboBox1.DataField是什么意思
begin
DBComboBox1.Left:=Rect.Left+DBGrid1.Left; //解释
DBComboBox1.Top:=Rect.Top+DBGrid1.Top;//解释一下
DBComboBox1.Width:=Rect.Right-Rect.Left;//解释一下
DBComboBox1.Height:=Rect.Bottom-Rect.Top;//解释一下
DBComboBox1.Visible:=True;//解释
end;
end;
end;
procedure TForm1.DBGrid1ColExit(Sender: TObject);
begin
if DBGrid1.SelectedField.FieldName=DBComboBox1.DataField then
begin
DBComboBox1.Visible:=False;
end;
end;
procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if(Key<>Chr(9)) then //解释
begin
if(DBGrid1.SelectedField.FieldName=DBComboBox1.DataField) then
begin
DBComboBox1.SetFocus;//什么意思
SendMessage(DBComboBox1.Handle,,WM_CHAR word(key),0);//解释
end;
end;
end;
Field: TField; State: TGridDrawState);
begin
if(gdFocused in State) then // gdFocused in State是什么意思
begin
if(Field.FieldName=DBComboBox1.DataField) then//DBComboBox1.DataField是什么意思
begin
DBComboBox1.Left:=Rect.Left+DBGrid1.Left; //解释
DBComboBox1.Top:=Rect.Top+DBGrid1.Top;//解释一下
DBComboBox1.Width:=Rect.Right-Rect.Left;//解释一下
DBComboBox1.Height:=Rect.Bottom-Rect.Top;//解释一下
DBComboBox1.Visible:=True;//解释
end;
end;
end;
procedure TForm1.DBGrid1ColExit(Sender: TObject);
begin
if DBGrid1.SelectedField.FieldName=DBComboBox1.DataField then
begin
DBComboBox1.Visible:=False;
end;
end;
procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if(Key<>Chr(9)) then //解释
begin
if(DBGrid1.SelectedField.FieldName=DBComboBox1.DataField) then
begin
DBComboBox1.SetFocus;//什么意思
SendMessage(DBComboBox1.Handle,,WM_CHAR word(key),0);//解释
end;
end;
end;