jicoff
Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору yuish Вот выдрал из примера, сам не разбирался, может чем-то поможет. function TCustomDrawDemoMainForm.DrawCellItem(AItem: TcxItemCustomDrawInfo; ACanvas: TcxCanvas; AValueInfo: TcxRowValueInfo; APainter: TcxvgPainter; Sender: TObject): Boolean; procedure OwnerDrawText(ALineColor: TColor; AFont: TFont); var ARect: TRect; begin ACanvas.Pen.Color := ALineColor; ACanvas.Brush.Style := bsClear; ACanvas.Font := AFont; ARect := cxRectInflate(AValueInfo.BoundsRect, -1, 0, 0, -1); with ARect do ACanvas.Canvas.Rectangle(Left, Top, Right, Bottom); if AValueInfo.EditViewInfo is TcxCustomCheckBoxViewInfo then with TcxCustomCheckBoxViewInfo(AValueInfo.EditViewInfo) do AValueInfo.LookAndFeelPainterClass.DrawCheckButton(ACanvas, cxRectOffset(CheckBoxRect, AValueInfo.BoundsRect.Left, AValueInfo.BoundsRect.Top), cxbsDefault, State = cbsChecked) else if AValueInfo.EditViewInfo is TcxCustomTextEditViewInfo then with TcxCustomTextEditViewInfo(AValueInfo.EditViewInfo) do ACanvas.DrawTexT(Text, cxRectInflate(AValueInfo.BoundsRect, -2, -2), 0); end; var AStyle: TcxStyle; begin TcxVerticalGrid(Sender).ViewInfo.LinesInfo.Clear; AValueInfo.Transparent := (AValueInfo.ViewParams.Bitmap <> nil) and (not AValueInfo.ViewParams.Bitmap.Empty); if AItem.DrawingStyle = cdsDefaultDrawing then begin APainter.DrawRowValueCell(AValueInfo); DrawCellsLines(ACanvas, TcxVerticalGrid(Sender).OptionsView.GridLineColor, AValueInfo.BoundsRect); DrawRightLine(ACanvas, TcxVerticalGrid(Sender).OptionsView.GridLineColor, AValueInfo.BoundsRect); Result := True; Exit; end; if AItem.DrawingStyle = cdsDependsOnData then begin if cxDBVerticalGridCustomer.Properties.Values[AValueInfo.RecordIndex] = 'Y' then AStyle := CustomDrawDemoDataDM.stCustomer else AStyle := CustomDrawDemoDataDM.stNoCustomer; ACanvas.Brush.Color := AStyle.Color; ACanvas.FillRect(AValueInfo.VisibleRect); OwnerDrawText(AStyle.TextColor, AStyle.Font); DrawCellsLines(ACanvas, TcxVerticalGrid(Sender).OptionsView.GridLineColor, AValueInfo.BoundsRect); Result := True; end else begin Result := DrawItem(AItem, ACanvas, cxRectInflate(AValueInfo.BoundsRect, 0, 0, 1, 1) , Integer(AItem.ColorScheme) > 1); if AItem.OwnerTextDraw then OwnerDrawText(clGray, AItem.Font) else begin AValueInfo.Transparent := True; Result := False; end; end; end; |