ehlib 修改 使指示區背景色 和 數據區 背景色一致

對ehlib 顯示效果不夠滿意,而作的調整code

修改這個過程:

procedure TCustomDBGridEh.DrawIndicatorCell(ACol, ARow: Longint;
  AreaCol, AreaRow: Longint; ARect: TRect; AState: TGridDrawState;
  CellAreaType: TCellAreaTypeEh);


{ 註釋掉 這段代碼 
    if MultiSelected then
    begin
      BackColor := Canvas.Brush.Color;
      Highlight := HighlightNoDataCellColor(ACol, ARow,
        AreaCol, AreaRow, CellAreaType, AState, MultiSelected, BackColor, Canvas.Font);
      Canvas.Brush.Color := BackColor;
    end;
}


if dghShowRecNo in OptionsEh then
    begin
      TextRect := ARect;
      Dec(TextRect.Right, AIndicatorWidth + FRowselCheckboxesWidth);
      Canvas.Font.Size := Canvas.Font.Size - 1;

      if (ARecNo <= 0) or
         ((DataLink.DataSet.State = dsInsert) and IsCurrentRow(AreaRow)) or
         (DataGrouping.IsGroupingWorks and (ADrawGroupDataNode.NodeType = dntDataGroupEh))
        then SRecNo := ''
        else SRecNo := IntToStr(ARecNo);

//      WriteTextEh(Canvas, TextRect, False, 0, 0, SRecNo, taCenter, tlCenter,
//        True, False, 0, 0, UseRightToLeftReading);
      Canvas.Font.Color := TitleFont.Color;    // 增長這一行
      WriteCellText(nil, Canvas, TextRect, False, 0, 0, SRecNo, taCenter, tlCenter,
        True, False, 0, 0);
    end;


if (dghShowRecNo in OptionsEh) and
       (CellAreaType.VertType = vctFooterEh) and
       (AreaRow = 0) then
    begin
      TextRect := ARect;
      Dec(TextRect.Right, AIndicatorWidth);
      Canvas.Font := Font;
      Canvas.Font.Size := Canvas.Font.Size - 1;

      ARecNo := 0;
      if Assigned(DataLink) and DataLink.Active then
        ARecNo := DataLink.DataSet.RecordCount;
      if (ARecNo <= 0) or
         ((DataLink.DataSet.State = dsInsert) and IsCurrentRow(AreaRow))
        then SRecNo := ''
        else SRecNo := IntToStr(ARecNo);

//      WriteTextEh(Canvas, TextRect, False, 0, 0, SRecNo, taCenter, tlCenter,
//        True, False, 0, 0, UseRightToLeftReading);
      Canvas.Font.Color := TitleFont.Color;    // 增長這一行
      WriteCellText(nil, Canvas, TextRect, False, 0, 0, SRecNo, taCenter, tlCenter,
        True, False, 0, 0);
    end;

相關文章
相關標籤/搜索