Integer Overflow in TCrDbGrid
Posted: 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
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