📄 stychildu.pas
字号:
unit StyChildU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, WPRTEDefs, WPRTEPaint, WPCTRMemo, WPCTRRich, WPRuler, WP1Style,
StdCtrls;
type
TWPGlobalStyleChild = class(TForm)
WPVertRuler1: TWPVertRuler;
WPRuler1: TWPRuler;
WPRichText1: TWPRichText;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure WPRichText1OpenDialog(Sender: TObject;
DiaType: TWPCustomRtfEditDialog; var ResultValue: Boolean);
procedure Button1Click(Sender: TObject);
procedure WPRichText1InitializeRTFDataObject(Sender: TObject;
var RTFDataObject: TWPRTFDataCollection;
var RTFPropsObject: TWPRTFProps);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
const IOFORMAT = 'WPTOOLS-basetext,-nopageinfo';
implementation
uses StyMainU;
{$R *.dfm}
procedure TWPGlobalStyleChild.FormCreate(Sender: TObject);
begin
WPGlobalStyle.WPDefaultActions1.ControlledMemos.Add.EditBox := WPRichText1;
WPRichText1.WPToolBar := WPGlobalStyle.WPToolPanel1;
end;
procedure TWPGlobalStyleChild.WPRichText1InitializeRTFDataObject(
Sender: TObject; var RTFDataObject: TWPRTFDataCollection;
var RTFPropsObject: TWPRTFProps);
begin
RTFPropsObject := WPGlobalRTFProps;
// Don't forget to DETACH the object later!
end;
procedure TWPGlobalStyleChild.FormClose(Sender: TObject;
var Action: TCloseAction);
var i : Integer;
begin
Action := caFree;
WPGlobalRTFProps.DetachRTFData(WPRichText1.HeaderFooter); //DETACH!!!!
WPGlobalStyle.WPDefaultActions1.ControlledMemos.Remove(WPRichText1);
WPGlobalStyle.WPToolPanel1.RtfEdit := nil;
i := WPGlobalStyle.NameList.Items.IndexOf(Caption);
if i>=0 then
WPGlobalStyle.DataList.Strings[i] :=
WPRichText1.AsANSIString(IOFORMAT)
else
begin
WPGlobalStyle.NameList.Items.Add(Caption);
WPGlobalStyle.DataList.Append(WPRichText1.AsANSIString(IOFORMAT));
end;
end;
procedure TWPGlobalStyleChild.WPRichText1OpenDialog(Sender: TObject;
DiaType: TWPCustomRtfEditDialog; var ResultValue: Boolean);
var i : Integer;
begin
WPStyleOpenDialog(Self, Sender,DiaType,ResultValue);
if ResultValue then WPGlobalStyle.WPDefaultActions1.ControlledMemos.ReformatAll(true,true);
end;
procedure TWPGlobalStyleChild.Button1Click(Sender: TObject);
begin
ShowMessage( WPRichText1.ParStyles.GetWPCSS );
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -