Page 1 of 1

Integer Overflow in TCrDbGrid

Posted: Sun 07 Dec 2008 07:59
by Javan_Soft
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

Posted: Tue 09 Dec 2008 13:48
by Dimon
Thank you for the advice. We will fix this problem in the next SDAC build.

Posted: Wed 12 May 2010 11:35
by Javan_Soft
ur welcome