Column.GetBarType=ctDataList
procedure TForm3.DBGridEh1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumnEh; State: TGridDrawState); begin Column.Grid.Canvas.Brush.Color :=$0082A7FD;//$00C4C4FF;// $008096FF; // Column.Grid.Canvas.FillRect(Rect); Column.Grid.DefaultDrawColumnCell(Rect,DataCol,Column,State); end;
procedure TCustomDBGridEh.DefaultDrawColumnCell(const Rect: TRect; DataCol: Integer; Column: TColumnEh; State: TGridDrawState); var Value: string; ARect, ARect1: TRect; XFrameOffs, YFrameOffs, KeyIndex: Integer; RowHeight: Integer; IsCellFilled: Boolean; MultiLine: Boolean; begin ARect := Rect; if (dghFooter3D in OptionsEh) then begin XFrameOffs := 1; InflateRect(ARect, -1, -1); end else XFrameOffs := 2; YFrameOffs := XFrameOffs; if Flat then Dec(YFrameOffs); Value := Column.DisplayText;
IsCellFilled := False; if GridBackgroundFilled and (Canvas.Brush.Color = FInternalColor) then IsCellFilled := True; if DataLink.Active and MemTableSupport then RowHeight := RowHeights[FIntMemTable.InstantReadCurRowNum + TopDataOffset] else RowHeight := FStdDefaultRowHeight; // if Column.GetBarType in [ctCommon..ctKeyPickList] then if Column.GetBarType in [ctCommon..ctKeyPickList,ctDataList] then begin if Column.HideDuplicates and CheckColumnDuplicateValues(Column, FIntMemTable.InstantReadCurRowNum, Value, True) then Value := ''; MultiLine := Column.WordWrap and Column.CurLineWordWrap(RowHeight) ; WriteCellText(Column, Canvas, ARect, True, XFrameOffs, YFrameOffs, Value, Column.Alignment, Column.Layout, MultiLine, Column.EndEllipsis, 0, 0, not MultiLine) end else if Column.GetBarType = ctKeyImageList then begin Canvas.FillRect(ARect); if Column.Field = nil then KeyIndex := ColCellParamsEh.FImageIndex else KeyIndex := Column.KeyList.IndexOf(Column.Field.Text); if KeyIndex = -1 then KeyIndex := Column.NotInKeyListIndex; DrawClipped(Column.ImageList, nil, Canvas, ARect, KeyIndex, 0, taCenter, ARect); end else if Column.GetBarType = ctCheckboxes then begin Canvas.FillRect(ARect); ARect1.Left := ARect.Left + iif(ARect.Right - ARect.Left < DefaultCheckBoxWidth, 0, (ARect.Right - ARect.Left) shr 1 - DefaultCheckBoxWidth shr 1); ARect1.Right := iif(ARect.Right - ARect.Left < DefaultCheckBoxWidth, ARect.Right, ARect1.Left + DefaultCheckBoxWidth); ARect1.Top := ARect.Top + iif(ARect.Bottom - ARect.Top < DefaultCheckBoxHeight, 0, (ARect.Bottom - ARect.Top) shr 1 - DefaultCheckBoxHeight shr 1); ARect1.Bottom := iif(ARect.Bottom - ARect.Top < DefaultCheckBoxHeight, ARect.Bottom, ARect1.Top + DefaultCheckBoxHeight);
PaintButtonControl(Canvas, ARect1, Canvas.Brush.Color, bcsCheckboxEh, 0, Flat, False, True, Column.CheckboxState); end else if Column.GetBarType = ctGraphicData then DrawGraphicCell(Column, ARect, Canvas.Brush.Color, IsCellFilled);
end;
|