(Sender as TDBGridEh).DefaultDrawColumnCell(Rect,DataCol,Column,State);这段代码错误DefaultDrawColumnCell()调用
procedure TCustomDBGridEh.DefaultDrawColumnCell(const Rect: TRect;
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
var
Value: string;
ARect, ARect1: TRect;
XFrameOffs, YFrameOffs, KeyIndex: Integer;
RowHeight: Integer;
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; if FDataLink.Active and MemTableSupport
then RowHeight := RowHeights[FIntMemTable.InstantReadCurRowNum + TopDataOffset]
else RowHeight := FStdDefaultRowHeight;
if Column.GetColumnType in [ctCommon..ctKeyPickList] then
WriteTextEh(Canvas, ARect, True, XFrameOffs, YFrameOffs, Value,
Column.Alignment, Column.Layout, Column.WordWrap and Column.CurLineWordWrap(RowHeight),
Column.EndEllipsis, 0, 0, Column.UseRightToLeftReading)
else if Column.GetColumnType = ctKeyImageList then
begin
Canvas.FillRect(ARect);
if Column.Field = nil
then KeyIndex := FColCellParamsEh.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);
end else if Column.GetColumnType = 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); //DrawCheck(Canvas.Handle,ARect1,Column.CheckboxState,True,Flat);
PaintButtonControl {Eh}(Canvas, ARect1, Canvas.Brush.Color, bcsCheckboxEh,
0, Flat, False, True, Column.CheckboxState);
end else if Column.GetColumnType = ctGraphicData then
DrawGraphicCell(Column, ARect, Canvas.Brush.Color);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;
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; if FDataLink.Active and MemTableSupport
then RowHeight := RowHeights[FIntMemTable.InstantReadCurRowNum + TopDataOffset]
else RowHeight := FStdDefaultRowHeight;
if Column.GetColumnType in [ctCommon..ctKeyPickList] then
WriteTextEh(Canvas, ARect, True, XFrameOffs, YFrameOffs, Value,
Column.Alignment, Column.Layout, Column.WordWrap and Column.CurLineWordWrap(RowHeight),
Column.EndEllipsis, 0, 0, Column.UseRightToLeftReading)
else if Column.GetColumnType = ctKeyImageList then
begin
Canvas.FillRect(ARect);
if Column.Field = nil
then KeyIndex := FColCellParamsEh.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);
end else if Column.GetColumnType = 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); //DrawCheck(Canvas.Handle,ARect1,Column.CheckboxState,True,Flat);
PaintButtonControl {Eh}(Canvas, ARect1, Canvas.Brush.Color, bcsCheckboxEh,
0, Flat, False, True, Column.CheckboxState);
end else if Column.GetColumnType = ctGraphicData then
DrawGraphicCell(Column, ARect, Canvas.Brush.Color);end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货