2012/12/14

DBGrid繪圖上的一個小Bug

在Delphi 2010之後,DBGrid多了一個Drawing Style屬性,可以讓我們DBGrid更為漂亮

但不知怎麼的,常常在使用上見到「殘影」,難道Delphi改走武術路線不成?

當然不是,這是DBGrid的一個Bug

一直到XE3(2013)為止,這個Bug一直沒有解決

於是國外有人修改了VCL Source來解決這個問題

這邊轉貼他的Fix法:

  1. Copy the DBGrids.pas file to your applications folder. It is located in the \Source\Win32\DB folder.
  2. Search for FIndicators.Draw (There is only one occurrence in the entire unit located in the DrawCell method of TCustomDBGrid.)
  3. Change the line under the FIndicators.Draw line to the following:

1
2
(ARect.Top + ARect.Bottom - FIndicators.Height) shr 1, 
Indicator, dsTransparent, itImage, True);
The red bolded parameters are the additional parameters added to the Draw method call (which starts on the preceeding line).


詳情請見:

Themed Grids in Delphi 2010

沒有留言:

張貼留言