vladman
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Graach Вот, что-то придумал, пробуйте. В свой пример добавляйте обработчик OnDrawValue для cxVerticalGrid1, опишите поле private FHeaderHeight: Integer; в классе формы И, собственно, сами обработчики: Код: uses Math; ... ... procedure TForm2.cxVerticalGrid1DrawRowHeader(Sender: TObject; ACanvas: TcxCanvas; APainter: TcxvgPainter; AHeaderViewInfo: TcxCustomRowHeaderInfo; var Done: Boolean); var vCaptionTextRect: TRect; vText: string; begin vCaptionTextRect := AHeaderViewInfo.CaptionsInfo[0].CaptionTextRect; vText := AHeaderViewInfo.CaptionsInfo[0].Caption; ACanvas.Brush.Color := AHeaderViewInfo.ViewParams.Color; ACanvas.FillRect(AHeaderViewInfo.HeaderRect); FHeaderHeight := Windows.DrawText(ACanvas.Handle, PChar(vText), Length(vText), vCaptionTextRect, DT_CALCRECT or DT_WORDBREAK) + 4; Windows.DrawText(ACanvas.Handle, PChar(vText), Length(vText), vCaptionTextRect, DT_WORDBREAK); Done := True; end; procedure TForm2.cxVerticalGrid1DrawValue(Sender: TObject; ACanvas: TcxCanvas; APainter: TcxvgPainter; AValueInfo: TcxRowValueInfo; var Done: Boolean); var vContentRect: TRect; vText: string; vContentHeight: Integer; begin vContentRect := AValueInfo.ContentRect; vText := AValueInfo.DisplayValue; ACanvas.Brush.Color := AValueInfo.ViewParams.Color; ACanvas.FillRect(AValueInfo.ContentRect); vContentHeight := Windows.DrawText(ACanvas.Handle, PChar(vText), Length(vText), vContentRect, DT_CALCRECT or DT_WORDBREAK) + 4; AValueInfo.Row.Height := Max(FHeaderHeight, vContentHeight); Windows.DrawText(ACanvas.Handle, PChar(vText), Length(vText), vContentRect, DT_WORDBREAK); Done := True; end; |
|