Integer Overflow in TCrDbGrid

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Javan_Soft
Posts: 15
Joined: Wed 15 Jun 2005 09:43

Integer Overflow in TCrDbGrid

Post by Javan_Soft » Sun 07 Dec 2008 07:59

If you using TCrDbGrid in CrGrid Unit may see "Integer Overflow" in scrolling grid.

This error becuse of title aligment .
if you have source of this unit , you can change this line to avoid of this error :
procedure WriteText(ACanvas: TCanvas; ARect: TRect; DX, DY: integer;
const Text: string; Alignment: TAlignment; ARightToLeft: boolean);
Begin
.
.
.

Left := ARect.Left + (ARect.Right - ARect.Left) shr 1
- (ACanvas.TextWidth(Text) shr 1);

change to :

/ --------------------------------------------------------------------------
// Modified By Vakili 2008/12/07 11:17:18
// Old orginal
// --------------------------------------------------------------------------

Left := ARect.Left + (ARect.Right - ARect.Left) Div 2
- (ACanvas.TextWidth(Text) Div 2);



Note : Shr 1 = Div 2

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 09 Dec 2008 13:48

Thank you for the advice. We will fix this problem in the next SDAC build.

Javan_Soft
Posts: 15
Joined: Wed 15 Jun 2005 09:43

Post by Javan_Soft » Wed 12 May 2010 11:35

ur welcome

Post Reply