uBaseEditorForm.pas
上传用户:yjb1804
上传日期:2021-01-30
资源大小:3105k
文件大小:10k
源码类别:

Email服务器

开发平台:

Delphi

  1. unit uBaseEditorForm;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, dxBar, cxClasses, ExtCtrls, dxBarExtItems, ImgList, uHtmlEdit, OleCtrls,
  6.   SHDocVw, ActnList, dxSkinsCore, dxSkinsdxBarPainter, dxSkinBlack,
  7.   dxSkinBlue, dxSkinCaramel, dxSkinCoffee, {dxSkinDarkRoom,} dxSkinDarkSide,
  8.   {dxSkinFoggy,} dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian,
  9.   dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  10.   dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  11.   dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinPumpkin, {dxSkinSeven,}
  12.   {dxSkinSharp,} dxSkinSilver, {dxSkinSpringTime,} dxSkinStardust,
  13.   dxSkinSummer2008, dxSkinsDefaultPainters, dxSkinValentine,
  14.   dxSkinXmas2008Blue;
  15. type
  16.   TBaseEditorForm = class(TForm)
  17.     dxbrmngr1: TdxBarManager;
  18.     pnlEdit: TPanel;
  19.     dxbrbtn1: TdxBarButton;
  20.     dxBarSubItem1: TdxBarSubItem;
  21.     dxbrmngr1Bar1: TdxBar;
  22.     dxbrmngr1Bar2: TdxBar;
  23.     dxBarSubItem2: TdxBarSubItem;
  24.     dxbrbtn2: TdxBarButton;
  25.     dxbrbtn3: TdxBarButton;
  26.     dxbrbtn4: TdxBarButton;
  27.     dxbrbtn5: TdxBarButton;
  28.     dxbrsbtm1: TdxBarSubItem;
  29.     dxbrbtn6: TdxBarButton;
  30.     dxbrbtn7: TdxBarButton;
  31.     dxbrbtn8: TdxBarButton;
  32.     pnlEditHeader: TPanel;
  33.     dxbrmngr1Bar3: TdxBar;
  34.     dxbrbtn9: TdxBarButton;
  35.     dxbrdckcntrl1: TdxBarDockControl;
  36.     il1: TImageList;
  37.     btnFontName: TdxBarFontNameCombo;
  38.     btnFontSize: TdxBarSpinEdit;
  39.     dxbrclrcmb1: TdxBarColorCombo;
  40.     pm1: TdxBarPopupMenu;
  41.     dxbrbtn10: TdxBarButton;
  42.     dxbrbtn11: TdxBarButton;
  43.     dxbrbtn12: TdxBarButton;
  44.     dxbrbtn13: TdxBarButton;
  45.     dxbrbtn14: TdxBarButton;
  46.     dxbrsbtm2: TdxBarSubItem;
  47.     dxbrbtn15: TdxBarButton;
  48.     dxbrbtn16: TdxBarButton;
  49.     dxbrbtn17: TdxBarButton;
  50.     dxbrbtn18: TdxBarButton;
  51.     lbl1: TdxBarStatic;
  52.     btnFontColor: TdxBarColorCombo;
  53.     btnFontBackColor: TdxBarColorCombo;
  54.     dxbrbtn19: TdxBarButton;
  55.     dxbrbtn20: TdxBarButton;
  56.     dxbrbtn21: TdxBarButton;
  57.     dxbrbtn22: TdxBarButton;
  58.     dxbrbtn23: TdxBarButton;
  59.     dxbrbtn24: TdxBarButton;
  60.     dxbrbtn25: TdxBarButton;
  61.     dxbrbtn26: TdxBarButton;
  62.     actlst1: TActionList;
  63.     dxbrbtn27: TdxBarButton;
  64.     dxbrbtn28: TdxBarButton;
  65.     dxbrbtn29: TdxBarButton;
  66.     dxbrbtn30: TdxBarButton;
  67.     dxbrbtn31: TdxBarButton;
  68.     actUndo: TAction;
  69.     actRedo: TAction;
  70.     actReplace: TAction;
  71.     actSearch: TAction;
  72.     actCut: TAction;
  73.     actCopy: TAction;
  74.     actPaste: TAction;
  75.     actInsertImg: TAction;
  76.     actInsertHLine: TAction;
  77.     actInsertHyperLine: TAction;
  78.     actAlignLeft: TAction;
  79.     actAlignRigth: TAction;
  80.     actInsertTable: TAction;
  81.     actAlignMid: TAction;
  82.     actIndenIn: TAction;
  83.     actIndenOut: TAction;
  84.     actStrikeLine: TAction;
  85.     actFoneItalic: TAction;
  86.     actFontBlod: TAction;
  87.     actInsertHeader: TAction;
  88.     actFontBackColor: TAction;
  89.     actFontColor: TAction;
  90.     actFontSize: TAction;
  91.     actFontUnderLine: TAction;
  92.     actFontName: TAction;
  93.     actSelectAll: TAction;
  94.     dlgOpen: TOpenDialog;
  95.     dlgSave: TSaveDialog;
  96.     dxbrbtn32: TdxBarButton;
  97.     dxbrbtn33: TdxBarButton;
  98.     dxbrbtn34: TdxBarButton;
  99.     dxbrbtn35: TdxBarButton;
  100.     dxbrbtn36: TdxBarButton;
  101.     dxbrbtn37: TdxBarButton;
  102.     dxbrbtn38: TdxBarButton;
  103.     dxbrbtn39: TdxBarButton;
  104.     dxbrbtn40: TdxBarButton;
  105.     dxbrbtn41: TdxBarButton;
  106.     dxbrbtn42: TdxBarButton;
  107.     dxbrbtn43: TdxBarButton;
  108.     dxbrbtn44: TdxBarButton;
  109.     dxbrbtn45: TdxBarButton;
  110.     dxbrbtn46: TdxBarButton;
  111.     dxbrsbtm3: TdxBarSubItem;
  112.     dxbrbtn47: TdxBarButton;
  113.     dxbrbtn48: TdxBarButton;
  114.     dxbrbtn49: TdxBarButton;
  115.     pm2: TdxBarPopupMenu;
  116.     dxbrbtn50: TdxBarButton;
  117.     dxbrbtn51: TdxBarButton;
  118.     dxbrbtn52: TdxBarButton;
  119.     actInsertButton: TAction;
  120.     actInsertLabel: TAction;
  121.     actInsertEdit: TAction;
  122.     htmlEdit: THtmlEdit;
  123.     procedure actUndoExecute(Sender: TObject);
  124.     procedure actRedoExecute(Sender: TObject);
  125.     procedure actReplaceExecute(Sender: TObject);
  126.     procedure actSearchExecute(Sender: TObject);
  127.     procedure actCutExecute(Sender: TObject);
  128.     procedure actCopyExecute(Sender: TObject);
  129.     procedure actPasteExecute(Sender: TObject);
  130.     procedure actInsertHLineExecute(Sender: TObject);
  131.     procedure actSelectAllExecute(Sender: TObject);
  132.     procedure actInsertImgExecute(Sender: TObject);
  133.     procedure actInsertHyperLineExecute(Sender: TObject);
  134.     procedure actInsertHeaderExecute(Sender: TObject);
  135.     procedure actAlignLeftExecute(Sender: TObject);
  136.     procedure actAlignRigthExecute(Sender: TObject);
  137.     procedure actAlignMidExecute(Sender: TObject);
  138.     procedure actInsertTableExecute(Sender: TObject);
  139.     procedure actIndenInExecute(Sender: TObject);
  140.     procedure actIndenOutExecute(Sender: TObject);
  141.     procedure actStrikeLineExecute(Sender: TObject);
  142.     procedure actFontUnderLineExecute(Sender: TObject);
  143.     procedure actFontSizeExecute(Sender: TObject);
  144.     procedure actFoneItalicExecute(Sender: TObject);
  145.     procedure actFontBlodExecute(Sender: TObject);
  146.     procedure actFontColorExecute(Sender: TObject);
  147.     procedure actFontBackColorExecute(Sender: TObject);
  148.     procedure actFontNameExecute(Sender: TObject);
  149.     procedure dxbrbtn10Click(Sender: TObject);
  150.     procedure dxbrbtn11Click(Sender: TObject);
  151.     procedure dxbrbtn12Click(Sender: TObject);
  152.     procedure dxbrbtn36Click(Sender: TObject);
  153.     procedure dxbrbtn37Click(Sender: TObject);
  154.     procedure dxbrbtn47Click(Sender: TObject);
  155.     procedure btnFontSizeButtonClick(Sender: TdxBarSpinEdit;
  156.       Button: TdxBarSpinEditButton);
  157.     procedure dxbrbtn50Click(Sender: TObject);
  158.     procedure actInsertButtonExecute(Sender: TObject);
  159.     procedure actInsertLabelExecute(Sender: TObject);
  160.     procedure actInsertEditExecute(Sender: TObject);
  161.   private
  162.     { Private declarations }
  163.   public
  164.     { Public declarations }
  165.   end;
  166. var
  167.   BaseEditorForm: TBaseEditorForm;
  168. implementation
  169. uses uCommon,Math, ufrmGridLineCount;
  170. {$R *.dfm}
  171. procedure TBaseEditorForm.actUndoExecute(Sender: TObject);
  172. begin
  173.   htmlEdit.Undo;
  174. end;
  175. procedure TBaseEditorForm.actRedoExecute(Sender: TObject);
  176. begin
  177.   htmlEdit.Redo;
  178. end;
  179. procedure TBaseEditorForm.actReplaceExecute(Sender: TObject);
  180. begin
  181.   //
  182. end;
  183. procedure TBaseEditorForm.actSearchExecute(Sender: TObject);
  184. begin
  185.   htmlEdit.SearchText;
  186. end;
  187. procedure TBaseEditorForm.actCutExecute(Sender: TObject);
  188. begin
  189.   htmlEdit.Cut;
  190. end;
  191. procedure TBaseEditorForm.actCopyExecute(Sender: TObject);
  192. begin
  193.   htmlEdit.Copy;
  194. end;
  195. procedure TBaseEditorForm.actPasteExecute(Sender: TObject);
  196. begin
  197.   htmlEdit.Paste;
  198. end;
  199. procedure TBaseEditorForm.actInsertHLineExecute(Sender: TObject);
  200. begin
  201.   htmlEdit.Edit.InsertHr;
  202. end;
  203. procedure TBaseEditorForm.actSelectAllExecute(Sender: TObject);
  204. begin
  205.   htmlEdit.SelectAll;
  206. end;
  207. procedure TBaseEditorForm.actInsertImgExecute(Sender: TObject);
  208. begin
  209.   dlgOpen.Filter:='BMP文件|*.bmp|GIF动画|*.GIF|ico图标|*.ico|所有文件|*.*';
  210.   if dlgOpen.Execute then
  211.     htmlEdit.Edit.InsertImage(dlgOpen.FileName);
  212. end;
  213. procedure TBaseEditorForm.actInsertHyperLineExecute(Sender: TObject);
  214. begin
  215.   htmlEdit.Edit.CreateLink ;
  216. end;
  217. procedure TBaseEditorForm.actInsertHeaderExecute(Sender: TObject);
  218. begin
  219. //
  220. end;
  221. procedure TBaseEditorForm.actAlignLeftExecute(Sender: TObject);
  222. begin
  223.   htmlEdit.Edit.JustifyLeft;
  224. end;
  225. procedure TBaseEditorForm.actAlignRigthExecute(Sender: TObject);
  226. begin
  227.   htmlEdit.Edit.JustifyRight;
  228. end;
  229. procedure TBaseEditorForm.actAlignMidExecute(Sender: TObject);
  230. begin
  231.   htmlEdit.Edit.JustifyCenter;
  232. end;
  233. procedure TBaseEditorForm.actInsertTableExecute(Sender: TObject);
  234. begin
  235.   with TfrmGridLineCount.Create(nil) do
  236.   try
  237.     if ShowModal=mrOk then
  238.       htmlEdit.Edit.InsertTable(StrToInt(cbCol.Text),StrToInt(cbRow.Text),StrToInt(cbBorlder.Text));
  239.   finally
  240.     Free;
  241.   end;
  242. end;
  243. procedure TBaseEditorForm.actIndenInExecute(Sender: TObject);
  244. begin
  245.   htmlEdit.Edit.InDent;
  246. end;
  247. procedure TBaseEditorForm.actIndenOutExecute(Sender: TObject);
  248. begin
  249.   htmlEdit.Edit.OutDent;
  250. end;
  251. procedure TBaseEditorForm.actStrikeLineExecute(Sender: TObject);
  252. begin
  253.   htmlEdit.Edit.StrikeThrough;
  254. end;
  255. procedure TBaseEditorForm.actFontUnderLineExecute(Sender: TObject);
  256. begin
  257.   htmlEdit.Edit.UnderLine;
  258. end;
  259. procedure TBaseEditorForm.actFontSizeExecute(Sender: TObject);
  260. begin
  261.   htmlEdit.Edit.FontSize(Ceil(btnFontSize.CurValue));
  262. end;
  263. procedure TBaseEditorForm.actFoneItalicExecute(Sender: TObject);
  264. begin
  265.   htmlEdit.Edit.Italic;
  266. end;
  267. procedure TBaseEditorForm.actFontBlodExecute(Sender: TObject);
  268. begin
  269.   htmlEdit.Edit.Bold;
  270. end;
  271. procedure TBaseEditorForm.actFontColorExecute(Sender: TObject);
  272. begin
  273.   htmlEdit.Edit.ForeColor(btnFontColor.CurColor);
  274. end;
  275. procedure TBaseEditorForm.actFontBackColorExecute(Sender: TObject);
  276. begin
  277.   htmlEdit.Edit.BackColor(btnFontBackColor.CurColor);
  278. end;
  279. procedure TBaseEditorForm.actFontNameExecute(Sender: TObject);
  280. begin
  281.   htmlEdit.Edit.FontName(btnFontName.CurText)
  282. end;
  283. procedure TBaseEditorForm.dxbrbtn10Click(Sender: TObject);
  284. begin
  285.   htmlEdit.Edit.InsertH1(DateTimeToStr(Now));
  286. end;
  287. procedure TBaseEditorForm.dxbrbtn11Click(Sender: TObject);
  288. begin
  289.     htmlEdit.Edit.InsertH2(DateTimeToStr(Now));
  290. end;
  291. procedure TBaseEditorForm.dxbrbtn12Click(Sender: TObject);
  292. begin
  293.     htmlEdit.Edit.InsertH3(DateTimeToStr(Now));
  294. end;
  295. procedure TBaseEditorForm.dxbrbtn36Click(Sender: TObject);
  296. begin
  297.     htmlEdit.Edit.InsertH4(DateTimeToStr(Now));
  298. end;
  299. procedure TBaseEditorForm.dxbrbtn37Click(Sender: TObject);
  300. begin
  301.     htmlEdit.Edit.InsertH5(DateTimeToStr(Now));
  302. end;
  303. procedure TBaseEditorForm.dxbrbtn47Click(Sender: TObject);
  304. begin
  305.    //htmlEdit.Edit.InsertUnorderedList();
  306. end;
  307. procedure TBaseEditorForm.btnFontSizeButtonClick(Sender: TdxBarSpinEdit;
  308.   Button: TdxBarSpinEditButton);
  309. begin
  310.   actFontSizeExecute(btnFontSize);
  311. end;
  312. procedure TBaseEditorForm.dxbrbtn50Click(Sender: TObject);
  313. begin
  314.   //htmlEdit.Edit.IN
  315. end;
  316. procedure TBaseEditorForm.actInsertButtonExecute(Sender: TObject);
  317. begin
  318.   htmlEdit.Edit.InsertButton('button');
  319. end;
  320. procedure TBaseEditorForm.actInsertLabelExecute(Sender: TObject);
  321. begin
  322.   htmlEdit.Edit.InsertLabel('label');
  323. end;
  324. procedure TBaseEditorForm.actInsertEditExecute(Sender: TObject);
  325. begin
  326.   htmlEdit.Edit.InsertEdit('edit');
  327. end;
  328. end.