transparent background

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
dave novo
Posts: 105
Joined: Wed Aug 31, 2005 2:13 am

transparent background

Post by dave novo »

Hello,

We use DrawPage to render the ScaleRichView to a canvas. But we do not want to have a background to the ScaleRichView.

We have tracked down the code to here. If you comment out the lines and add what we added, you can get a transparent background. Of course, you can add a special property to the page properties use that to make the background transparent as well, we just wanted to make minimal changes.

We can modify the code of course, but prefer to make whatever modification locally that will makes it into the release branch.

function TSRichViewEdit.DrawPageBG(Canvas: TCanvas;
PageRect, PaintRect: TRect;
ScaleX, ScaleY: Single;
OffsetX, OffsetY, PageNo: Integer; Printing, UseWordPainters: Boolean): Boolean;
var
PgW, PgH, PictWidth, PictHeight, SPictWidth, SPictHeight : Integer;
indexX, indexY, OffX, OffY: Integer;
BGImage: TBitmap;
OldRect : TRect;
hRegion: HRGN;

procedure FillBG;
begin
If FBackgroundProperty.FGlobalPageBackgroundColor = clNone then
// Removed this min->white
// Canvas.Brush.Color := min(SRVGetSysColor(FRichViewEdit.Color), $0FFFFFF)
Canvas.Brush.Color := SRVGetSysColor(FRichViewEdit.Color)
Else
Canvas.Brush.Color := SRVGetSysColor(FBackgroundProperty.FGlobalPageBackgroundColor);

// Added this if
if Canvas.Brush.Color <> clNone then
Canvas.FillRect(PaintRect);
end;
Sergey Tkachenko
Site Admin
Posts: 17554
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Accepted (with some correction: when called to draw TSRichViewEdit itself, clWhite will be used instead of clNone)
dave novo
Posts: 105
Joined: Wed Aug 31, 2005 2:13 am

Post by dave novo »

Hi Sergey,

Can you paste in the actual code you will use. We will then copy that to our local version.
Sergey Tkachenko
Site Admin
Posts: 17554
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can update your version - this change is included in SRV 4.8.
dave novo
Posts: 105
Joined: Wed Aug 31, 2005 2:13 am

Post by dave novo »

Hi Sergey,

Just wondering what your "correction" is going to be. You wrote
with some correction:
Sergey Tkachenko
Site Admin
Posts: 17554
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Parameter AllowTransparency in DrawPageBG. True when called from DrawPage, False when called to draw the component itself.
If False, clNone is painted as clWhite.
Post Reply