FillRect doesn't paint the complete TStringGrid cell in Delphi XE2

前端 未结 4 1422
既然无缘
既然无缘 2021-01-04 03:16

FillRect doesn\'t paint the complete TStringGrid cell in Delphi XE2. There is a gap of 3 pixels on the left side in the default color (with B

相关标签:
4条回答
  • 2021-01-04 03:35

    You can use the StringGrid1.CellRect(ACol, ARow) that returns the actual TRect of the cell instead of using the parameter Rect.

    0 讨论(0)
  • 2021-01-04 03:40

    Turn off the first 4 options in TStringGrid:

    • goFixedVertLine
    • goFixedHorizLine
    • goVertLine
    • goHorizLine

    Then it won't paint the grid lines, and your grid cells will paint right to the edges. Just tried it with XE.

    0 讨论(0)
  • 2021-01-04 03:48

    This is expected behaviour in XE2 when DefaultDrawing = true and themes are enabled (I'm not going to argue about good or bad here - as you might have noticed, the behaviour is different for RigthToLeft mode...).

    A workaround is to check for this condition and decrement Rect.Left by 4 pixel before calling FillRect.

    0 讨论(0)
  • 2021-01-04 03:50

    Since you're drawing the grid cell yourself then just turn off the grid property DefaultDrawing, set it to false.

    0 讨论(0)
提交回复
热议问题