2015-11-17 20 views
0

我正在開發一個項目使用Delphi XE7 UP1 & Delphi 10西雅圖Android & IOS。使用Stringgrid來顯示數據,在stringgrid上我有7列,直到第4列它適合屏幕其他列我需要向左滑動,使用AlternatingRowBackground爲true,直到第4列系統繪製ColLines,RowLines和Alternate顏色就好了,但當我向左滑動以查看其他列ColLines,RowLines和Alternate顏色消失時,我的意思是隻有列標題和白色頁面。請看截圖: from column 1 to 4 from column 4 to 7 and lines are gone 所以我已經試過stringgrid1.repaint - StringGrid1.RealignContent - StringGrid1.UpdateEffects - updatecolumns等,但沒有工作,據我瞭解系統繪製行&山坳線至於屏幕的寬度。是否有任何解決方法保持顏色,在所有網格中排第& col行?Firemonkey Stringgrid Rowlines僅作爲屏幕寬度繪製

在此先感謝,對不起不好英語:)

+0

真的嗎?沒有人 ? – BMF

回答

0

,如果有人需要在未來,這裏是解決方案

procedure TForm1.StringGrid1DrawColumnCell(Sender: TObject; const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF; const Row: Integer; const Value: TValue; const State: TGridDrawStates); 
var 
    T, T2: TRectF; 
begin 
    if Row mod 2 = 1 then 
    begin 
    with Canvas do 
    begin 
     Fill.Kind := TBrushKind.Solid; 
     Fill.Color := $FFF5802D; 
    end; 

    T := Bounds; 
    if TStringGrid(Sender).ColumnCount - 1 = Column.Index then 
     T.Right := Self.Width; 
    Canvas.FillRect(T, 0, 0, [], 0.5); 
    end; 

end;