transparent background
Posted: Thu Sep 13, 2012 4:48 am
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;
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;