![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
CheckBox в DBGrid [D6]
Russko © (2004-03-05 09:24:00)Созрел такой вопрос - каким образом можно в одно из полей вставить CheckBox? Спасибо!
stone (2004-03-05 10:24:00) [1]if (gdFocused in State) then
if (Column.Field.FieldName = DBCheckBox.Field.FieldName) then
begin
// Вместо стандартного InplaceEditor'а показываем DBCheckBox
DBCheckBox.Left := Rect.Left + DBGrid.Left + (Rect.Right - Rect.Left - DBCheckBox.Width) div 2;
DBCheckBox.Top := Rect.Top + DBGrid.top + 4;
DBCheckBox.Visible := true;
end
Sergey_Masloff (2004-03-05 09:27:00) [2]
procedure TfmMyFind.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
I: Integer;
R: TRect;
begin
if Column.Field = qryFind.FieldByName('SELECTION') then begin
(Sender as TDBGrid).Canvas.FillRect(Rect);
R := Rect;
InflateRect(R, 0, -2);
if qryFind.FieldByName('SELECTION').AsInteger = 1 then
I := DFCS_BUTTONCHECK + DFCS_CHECKED
else
I := DFCS_BUTTONCHECK;
DrawFrameControl((Sender as TDBGrid).Canvas.Handle, R, DFC_BUTTON, I);
end else
(Sender as TDBGrid).DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
stas (2004-03-05 09:26:00) [3]Поле должно быть типа Boolean.
А там зависит от Controla