📄 rvpp.pas
字号:
{==============================} unit RVPP; {===========================}
{ unit RVPP: }
{ components: }
{ TRVPrintPreview (registered in "RichView" palette page) }
{-----------------------------------------------------------------------}
{ Copyright (C) S.Tkachenko }
{=======================================================================}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
RVScroll, PtblRV, Printers, CRVPP;
{$I RV_Defs.inc}
type
TRVPrintPreview = class(TCustomRVPrintPreview)
private
{ Private declarations }
FRVPrint: TCustomRVPrint;
procedure SetRVPrint(const Value: TCustomRVPrint);
protected
{ Protected declarations }
procedure Notification(AComponent: TComponent; Operation: TOperation);override;
function CanDrawContents: Boolean; override;
procedure DrawContents(Canvas:TCanvas; const R: TRect); override;
procedure DrawMargins(Canvas:TCanvas; const R: TRect; PageNo: Integer); override;
function GetPreview100PercentWidth: Integer; override;
function GetPreview100PercentHeight: Integer; override;
function GetPageCount: Integer; override;
procedure SetPageNo(const Value: Integer); override;
procedure Loaded; override;
public
{ Public declarations }
published
{ Published declarations }
property RVPrint: TCustomRVPrint read FRVPrint write SetRVPrint;
property ZoomInCursor;
property ZoomOutCursor;
property OnZoomChanged;
property MarginsPen;
{ Published standard properties }
property Align;
{$IFDEF RICHVIEWDEF4}
property Anchors;
property Constraints;
{$ENDIF}
property Ctl3D;
{$IFDEF RICHVIEWDEF4}
property DragKind;
{$ENDIF}
property DragMode;
property Enabled;
property HelpContext;
property ParentCtl3D;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop default True;
property UseXPThemes;
property Visible;
{ Published standard events }
property OnClick;
{$IFDEF RICHVIEWDEF5}
property OnContextPopup;
{$ENDIF}
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
{$IFDEF RICHVIEWDEF4}
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
{$ENDIF}
property OnStartDrag;
{ Published RichView properties }
property BorderStyle;
{$IFDEF RVFLATSCROLLBARS}
property ScrollBarColor;
property ScrollBarStyle;
{$ENDIF}
property Tracking;
{$IFDEF RICHVIEWDEF4}
property WheelStep;
{$ENDIF}
end;
implementation
{========================== TRVPrintPreview ============================}
procedure TRVPrintPreview.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation=opRemove) and (AComponent=RVPrint) then begin
FRVPrint := nil;
end;
end;
{-----------------------------------------------------------------------}
procedure TRVPrintPreview.Loaded;
begin
inherited Loaded;
UpdatePaletteInfo;
end;
{-----------------------------------------------------------------------}
function TRVPrintPreview.CanDrawContents: Boolean;
begin
Result := (RVPrint<>nil) and RVPrint.Ready;
end;
{-----------------------------------------------------------------------}
procedure TRVPrintPreview.DrawContents(Canvas:TCanvas; const R: TRect);
begin
RVPrint.DrawPreview(PageNo, Canvas, R);
end;
{-----------------------------------------------------------------------}
procedure TRVPrintPreview.DrawMargins(Canvas:TCanvas; const R: TRect; PageNo: Integer);
begin
inherited DrawMargins(Canvas, R, PageNo);
RVPrint.DrawMarginsRect(Canvas, R, PageNo);
end;
{-----------------------------------------------------------------------}
function TRVPrintPreview.GetPreview100PercentHeight: Integer;
begin
Result := FRVPrint.Preview100PercentHeight;
end;
{-----------------------------------------------------------------------}
function TRVPrintPreview.GetPreview100PercentWidth: Integer;
begin
Result := FRVPrint.Preview100PercentWidth;
end;
{-----------------------------------------------------------------------}
procedure TRVPrintPreview.SetRVPrint(const Value: TCustomRVPrint);
begin
FRVPrint := Value;
if FRVPrint<>nil then
DoInPaletteMode := FRVPrint.rv.DoInPaletteMode;
UpdateView;
end;
{-----------------------------------------------------------------------}
function TRVPrintPreview.GetPageCount: Integer;
begin
Result := FRVPrint.PagesCount;
end;
{-----------------------------------------------------------------------}
procedure TRVPrintPreview.SetPageNo(const Value: Integer);
begin
if FRVPrint<>nil then
DoInPaletteMode := FRVPrint.rv.DoInPaletteMode;
inherited;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -