Page 2 of 2

PostPosted: June 6th, 2005, 2:08 pm
by P_G
Hi Kambiz,

For testing I deleted the SelectClipRgn line:

Code: Select all
procedure TGraphNode.DrawBackground(Canvas: TCanvas);
var
  ClipRgn: HRGN;
  Bitmap: TBitmap;
  Graphic: TGraphic;
begin
  if Background.Graphic <> nil then
  begin
    ClipRgn := CreateClipRgn(Canvas);
    try
    //  SelectClipRgn(Canvas.Handle, ClipRgn);
      try
        Graphic := Background.Graphic;
        Background.OnChange := nil;
        Canvas.StretchDraw(BoundsRect, Graphic);
        Background.OnChange := BackgroundChanged;
      finally
        SelectClipRgn(Canvas.Handle, 0);
      end;
    finally
      DeleteObject(ClipRgn);
    end;
    Canvas.Brush.Style := bsClear;
  end;
end;


Now it seems to work, however I asked myself which problems could occur by doing this, even though I didn't noticed any so far.

P_G

PostPosted: June 6th, 2005, 8:19 pm
by Kambiz
Asign a background image to a non-rectangular node to see what happens. :wink:

PostPosted: June 7th, 2005, 9:02 am
by P_G
This is the only problem? As a matter of fact in most cases I don't need other nodes than rectangular ones. So a good workaround for me could be something like: If all conditions for this bug are met, don't convert the metafile to a bitmap, but skip the clipping. If this is combined with a boolean variable (so the user can choose between bitmap conversion or clipping to workaround) everything would be absolutely perfect.

Yours, P_G