📄 uprintseldlg.pas
字号:
unit UPrintSelDlg;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TPrintSelDlg = class(TForm)
PrinterSetupDialog1: TPrinterSetupDialog;
GroupBox2: TGroupBox;
lbFileName: TLabel;
cbSelectedText: TCheckBox;
GroupBox1: TGroupBox;
Label2: TLabel;
cbHeader: TCheckBox;
cbLineNumbers: TCheckBox;
cbSyntaxPrint: TCheckBox;
cbColor: TCheckBox;
cbWrapLines: TCheckBox;
ebMargin: TEdit;
procedure SetupBtnClick(Sender: TObject);
procedure OKButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
PrintSelDlg: TPrintSelDlg;
implementation
uses uconst, mwCustomEdit, MainForm;
{$R *.DFM}
procedure TPrintSelDlg.SetupBtnClick(Sender: TObject);
begin
PrinterSetupDialog1.Execute;
end;
procedure TPrintSelDlg.OKButtonClick(Sender: TObject);
var
Options: TmwPrintOptions;
begin
Screen.Cursor:= crHourGlass;
Options.SelectedOnly:= cbSelectedText.Checked;
Options.Highlighted:= cbSyntaxPrint.Checked;
Options.PrintRange := Rect(0,0,0,0); // Not using it here.
Options.MarginUnits := muThousandthsOfInches;
Options.Margins := Rect(500, 500, 500, 500); // 1/2 inch margins
Options.WrapLongLines:= cbWrapLines.Checked;
Options.Copies := 1;
Options.Header := TStringList.Create;
Options.Footer := TStringList.Create;
Options.Title:= FMainForm.ActiveUnit;
try
Options.Header.AddObject('Title: $title$', TObject(hfaCenter));
Options.Header.AddObject('Printing Time and Date: $time$ $date$',TObject(hfaLeft));
Options.Header.Add('');
Options.Footer.Add('');
Options.Footer.AddObject('Page Number: $pagenum$ Printing Date/Time: $datetime$', TObject(hfaRight));
ActivePasEditor.Print(nil, Options);
finally
Options.Header.Free;
Options.Footer.Free;
end;
Screen.Cursor:= crDefault;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -