Показать сообщение отдельно
  #4  
Старый 18.08.2011, 15:22
Nicky Nicky вне форума
Прохожий
 
Регистрация: 18.08.2011
Сообщения: 3
Репутация: 10
По умолчанию

Тема закрыта.


Код:
procedure TAnalysisOfTrans.cxGridDBBandedTableViewCustomDrawCell(
  Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
  AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
Var r                 : TRect;
    iImageIndex, iVal : Integer;
    sVal              :string;
begin
  If (TcxGridDBBandedColumn(AViewInfo.Item) = cxGridDBBandedTableViewTEMP_OPEN) then
Begin
    iVal:= AViewInfo.GridRecord.Values[cxGridDBBandedTableViewTEMP_OPEN.Index];

   If (iVal > 0)
Then Begin
         iImageIndex := 0 ;
      End;

If (iVal < 0)
      Then Begin
         iImageIndex := 1 ;
      End;

If (iVal = 0)
      Then Begin
         iImageIndex := 2 ;
      End;

      R := AViewInfo.Bounds ;
      ACanvas.Brush.Color := AViewInfo.Params.Color;
      ACanvas.FillRect(R);

      // Draw the number left justified in the cell.
      Inc(r.Left,1);
      sVal := IntToStr(iVal);
      ACanvas.DrawTexT(sVal,r,cxAlignLeft or cxAlignVCenter);

       // draw the image right justified in the cell.
      // this assmues that the image is 16 x 16 pixles.
      R.Left := (R.Right - 16);
      Inc(r.Top,1);
      ACanvas.DrawImage(ImageList1,r.Left,r.Top,iImageIndex,True);
      ADone := True ;
   End;
end;
Ответить с цитированием