zoukankan      html  css  js  c++  java
  • 修复 XE8 Win 平台 Firemonkey Memo 卷动后会重叠的问题

    问题:XE8 Firemonkey 在 Windows 平台 Memo 卷动时,在第 1 , 2 行会产生重叠现象。

    更新:XE8 update 1 已经修复这个问题,无需再使用下面方法。

    修改前:

    修改后:

    适用:XE8 for Windows 平台

    修复方法:

    请将源码 FMX.Memo.Style.pas 复制到自己的工程目录里,再进行修改。

    找到 TStyledMemo.TLines.RenderLayouts; 函数,修改如下:

    procedure TStyledMemo.TLines.RenderLayouts;
    
    ..... 省略 ......
    
          if Line.Rect.IntersectsWith(Content) then
          begin
            if Line.Layout = nil then
            begin
              Layout := CreateLayout(FMemo.Model.Lines[I]);
              Size := TSizeF.Create(Max(1, Layout.Width), Layout.Height);
              HeightChanged := not SameValue(Line.Size.Height, Size.Height, TEpsilon.Position);
              ContentBoundsUpdated := ContentBoundsUpdated or (Line.Size <> Size);
              Line.Size := Size;
    
    {+++> 修复 Memo 卷动后会重叠的问题, by 龟山阿卍}
              if (Line.Rect.Top < 0) then
                 Line.Rect := TRectF.Create(-ViewPosition.X, -ViewPosition.Y, -ViewPosition.X + Line.Size.Width, Line.Size.Height)
              else
    {<+++}
    
              Line.Rect := TRectF.Create(-ViewPosition.X, 0, -ViewPosition.X + Line.Size.Width, Line.Size.Height);
              if (I > 0) then
                Line.Rect.Offset(0, FLines[I - 1].Rect.Bottom);
    
    ..... 省略 ......
    
    end;

    参考图:

  • 相关阅读:
    全栈的苦逼和崛起
    Swift内部类调用外部类方法、属性的变通
    Assets.xcassets误删后的恢复
    UITableViewCell嵌套UITableView的正确姿势
    GPU Accelerated Computing with Python
    Windows 10创意者更新ISO发布!官方下载
    Amazing iOS Tips
    self-sizing cell的一个问题
    buf.swap32()
    buf.swap16()
  • 原文地址:https://www.cnblogs.com/onechen/p/4397399.html
Copyright © 2011-2022 走看看