procedure TRtDashStylesCombo.DrawItem(Index: Integer; Rect:TRect;
State:TOwnerDrawState);
var Gap: Single; dGr: System.Drawing.Graphics; dPen: System.Drawing.Pen;
begin
Canvas.Brush.Color := Color;
Canvas.FillRect(Rect);
Gap := ItemHeight*0.5;
dGr := System.Drawing.Graphics.FromHdc(IntPtr(Canvas.Handle));
dPen :=
System.Drawing.Pen.Create(System.Drawing.Color.FromArgb(FLineColor));
....
The code woks as expected during firstly drawing the control and dropping
down items. But sometimes especially after clicking other combos and re
entering the user drawn combo it will run into a arithmetic overflow error
caused by the FromHdc creation of the graphics object.
Any idea how to solve this issue?
Regards Horst
> The code woks as expected during firstly drawing the control and dropping
> down items. But sometimes especially after clicking other combos and re
> entering the user drawn combo it will run into a arithmetic overflow error
> caused by the FromHdc creation of the graphics object.
> Any idea how to solve this issue?
Are you freeing or disposing of the graphics object?
Just out of curious why don't you just use the Canvas API's?
--
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com
> Just out of curious why don't you just use the Canvas API's?
I need special features like transparency, different dasstyles with
linewidth > 1 etc.
btw. the same error is displayed creating graphic objects with canvas.handle
of TBitmap.
Regards Horst
> btw. the same error is displayed creating graphic objects with canvas.handle
> of TBitmap.
It sounds like some GD objects are not being released properly.
no crashes anymore ;-))