• firemonkey Grid自定义


    http://stackoverflow.com/questions/28893564/memory-leak-on-tstringgrids-ondrawcolumncell-event

    http://stackoverflow.com/questions/26824307/how-to-display-a-multiline-text-in-a-stringgrid-cell-delphi-xe6-android

    http://stackoverflow.com/questions/25410901/firemonkey-xe5-livebinding-tgrid-cell-text-aligment

    http://cc.embarcadero.com/Item/28894

    ColumnHeader

    procedure TFrm.GridLDrawColumnHeader(Sender: TObject;
      const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF);
    begin
      Canvas.Fill.Color := TAlphaColorRec.Lightskyblue;
      Canvas.FillRect(Bounds, 0, 0, [], 1);
      Canvas.Fill.Color := TAlphaColorRec.White;
      // Canvas.te//设置字体
      Canvas.FillText(Bounds, Column.Header, False, 1, [], TTextAlign.Center, TTextAlign.Center);
    end;

     DrawColumnCell

     取Grid任意行任意列的值或者是可见区域的单元格值,未验证。

        Grid1.Model.GetValue(col,row);

    LeftColumn
    RigthColumn

    TopRow
    BottomRow

    Specifies the index of the first visible scrollable row in the grid.

    Read TopRow to determine the index of the first row in the scrollable region that is visible. Set TopRow to scroll the rows in the grid so that the row with the TopRow index is the first row after the fixed rows.

      head:THeader;
      LContent:TControl;

    head:=Grid1.FindStyleResource('header') as THeader;

    Grid1.FindStyleResource<THeader>(StrHeader, FHeader)

    Grid1.FindStyleResource<TControl>('header', LContent)

    获取grid操作系统默认选择行颜色值focus是选择单元格的值,selection是选中行的值。

    self.Rectangle1.Fill.Color:= ((self.Grid1.FindStyleResource('focus') as TControl) as TRectangle) .Fill.Color;
    self.Rectangle1.Fill.Color:= ((self.Grid1.FindStyleResource('selection') as TControl) as TRectangle) .Fill.Color;

    一次转换就可以。 

    self.Rectangle1.Fill.Color := (self.Grid1.FindStyleResource('focus') as TRectangle).Fill.Color;
     self.Rectangle1.Fill.Color := (self.Grid1.FindStyleResource('selection') as TRectangle).Fill.Color;

    FMX.Grid.Style文件里定义了这2种初始化的地方,如下:

    FindStyleResource<TControl>(StrFocus, FFocus)
    FindStyleResource<TControl>(StrSelection, FSelection)
     
    画当前行和当前单元格,TOpenControl(FSelectionClone).PaintInternal;TControl.PaintInternal;  最终调用了FMX.Objects里的TShape.Painting
  • 相关阅读:
    多维DP UVA 11552 Fewest Flop
    思维/构造 HDOJ 5353 Average
    map Codeforces Round #Pi (Div. 2) C. Geometric Progression
    构造 Codeforces Round #Pi (Div. 2) B. Berland National Library
    贪心+优先队列 HDOJ 5360 Hiking
    贪心 HDOJ 5355 Cake
    LIS UVA 10534 Wavio Sequence
    又见斐波那契~矩阵快速幂入门题
    Big Christmas Tree(poj-3013)最短路
    poj 2449 Remmarguts' Date 第k短路 (最短路变形)
  • 原文地址:https://www.cnblogs.com/cb168/p/5328201.html
Copyright © 2020-2023  润新知