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

Email服务器

开发平台:

Delphi

  1. unit uHtmlEditForm;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, ComCtrls, ToolWin,
  6.   OleCtrls, SHDocVw, ImgList, ActnList, uHtmlEdit,
  7.   ExtCtrls, Menus, StdCtrls, jpeg, ExtDlgs, Spin, ActnMan, ActnCtrls,
  8.   ActnMenus, XPStyleActnCtrls;
  9. type
  10.   THtmlEditForm = class(TForm)
  11.     ActionListButton: TActionList;
  12.     Act_New: TAction;
  13.     Act_Open: TAction;
  14.     Act_Save: TAction;
  15.     dlgColor1: TColorDialog;
  16.     dlgOpen: TOpenDialog;
  17.     dlgSave: TSaveDialog;
  18.     N1: TMenuItem;
  19.     pmHtmlEdit: TPopupMenu;
  20.     LargeImages: TImageList;
  21.     SmallImages: TImageList;
  22.     dlgOpenPic: TOpenPictureDialog;
  23.     Act_SaveAs: TAction;
  24.     Act_SaveTo: TAction;
  25.     Act_Clear: TAction;
  26.     Act_Redo: TAction;
  27.     Act_Undo: TAction;
  28.     Act_SelectAll: TAction;
  29.     Act_Print: TAction;
  30.     Act_PageSetup: TAction;
  31.     Act_PrintPreview: TAction;
  32.     Act_Write: TAction;
  33.     Act_Copy: TAction;
  34.     Act_Cut: TAction;
  35.     Act_Paste: TAction;
  36.     Act_Insert: TAction;
  37.     Act_Append: TAction;
  38.     Act_ViewSource: TAction;
  39.     Act_ViewText: TAction;
  40.     Act_Edit_BackColoer: TAction;
  41.     Act_Edit_Bold: TAction;
  42.     Act_Edit_CreateLink: TAction;
  43.     Act_Edit_ForeColor: TAction;
  44.     Act_Edit_HorizontalRule: TAction;
  45.     Act_Edit_InsertImage: TAction;
  46.     Act_Edit_InsertLineBreak: TAction;
  47.     Act_Edit_InsertOrderedlist: TAction;
  48.     Act_Edit_InsertTable: TAction;
  49.     Act_Edit_InsertUnOrderedList: TAction;
  50.     Act_Edit_JustifyCenter: TAction;
  51.     Act_Edit_JustifyFull: TAction;
  52.     Act_Edit_JustifyLeft: TAction;
  53.     Act_Edit_JustifyRight: TAction;
  54.     Act_Edit_Italic: TAction;
  55.     Act_Edit_RemoveFormat: TAction;
  56.     Act_Edit_ScrollToBottom: TAction;
  57.     Act_Edit_ScrollToTop: TAction;
  58.     Act_Edit_OutDent: TAction;
  59.     Act_Edit_InDent: TAction;
  60.     Act_Edit_SuperScript: TAction;
  61.     Act_Edit_SubScript: TAction;
  62.     Act_Edit_UnderLine: TAction;
  63.     Act_Edit_StrikeThrough: TAction;
  64.     pgc2: TPageControl;
  65.     ts4: TTabSheet;
  66.     ts5: TTabSheet;
  67.     HtmlEditRecv: THtmlEdit;
  68.     HtmlEdit: THtmlEdit;
  69.     CoolBar1: TCoolBar;
  70.     ActMainMenu: TActionMainMenuBar;
  71.     btnSend: TButton;
  72.     mmo1: TMemo;
  73.     grpEdit: TGroupBox;
  74.     lblTable: TLabel;
  75.     Label1: TLabel;
  76.     lbl1: TLabel;
  77.     btn2: TButton;
  78.     btn3: TButton;
  79.     btn5: TButton;
  80.     btn6: TButton;
  81.     btn1: TButton;
  82.     Button2: TButton;
  83.     btn7: TButton;
  84.     btn9: TButton;
  85.     btn10: TButton;
  86.     btn11: TButton;
  87.     btn12: TButton;
  88.     btn13: TButton;
  89.     btn14: TButton;
  90.     btn16: TButton;
  91.     btn18: TButton;
  92.     btn19: TButton;
  93.     btn20: TButton;
  94.     btn21: TButton;
  95.     btn22: TButton;
  96.     btn23: TButton;
  97.     btn25: TButton;
  98.     btn29: TButton;
  99.     btn30: TButton;
  100.     btn33: TButton;
  101.     cbbFontName: TComboBox;
  102.     edt2: TEdit;
  103.     edt3: TEdit;
  104.     sedtFontSize: TSpinEdit;
  105.     grpFile: TGroupBox;
  106.     btn36: TButton;
  107.     btnPaste: TButton;
  108.     btn38: TButton;
  109.     btnCut: TButton;
  110.     btnCopy: TButton;
  111.     btn31: TButton;
  112.     chkReadOnly: TCheckBox;
  113.     btnPrintPageSetup: TButton;
  114.     btn15: TButton;
  115.     btn17: TButton;
  116.     btn24: TButton;
  117.     btnSaveAs: TButton;
  118.     btn26: TButton;
  119.     btnSelectAll: TButton;
  120.     btn40: TButton;
  121.     btnViewSource: TButton;
  122.     btnViewText: TButton;
  123.     btnWrite: TButton;
  124.     btnExec: TButton;
  125.     edt1: TEdit;
  126.     btn28: TButton;
  127.     btnInsert: TButton;
  128.     btnAppend: TButton;
  129.     pnlToolsBar: TPanel;
  130.     CoolBar: TCoolBar;
  131.     PageScroller1: TPageScroller;
  132.     ToolBar: TToolBar;
  133.     tbsNew: TToolButton;
  134.     tbsOpen: TToolButton;
  135.     tbsSave: TToolButton;
  136.     PageScroller2: TPageScroller;
  137.     cbFontName: TComboBox;
  138.     cbFontSize: TComboBox;
  139.     PageScroller3: TPageScroller;
  140.     ToolBar2: TToolBar;
  141.     tbsBold: TToolButton;
  142.     tbsItalic: TToolButton;
  143.     tbsUnderLine: TToolButton;
  144.     tbsStrikeThrough: TToolButton;
  145.     PageScroller4: TPageScroller;
  146.     ToolBar3: TToolBar;
  147.     tbsPrint: TToolButton;
  148.     tbsPrintPreview: TToolButton;
  149.     PageScroller5: TPageScroller;
  150.     ToolBar1: TToolBar;
  151.     tbsCut: TToolButton;
  152.     tbsCopy: TToolButton;
  153.     tbsPaste: TToolButton;
  154.     tbsClear: TToolButton;
  155.     PageScroller6: TPageScroller;
  156.     ToolBar4: TToolBar;
  157.     tbsForeColor: TToolButton;
  158.     tbsBackColoer: TToolButton;
  159.     PageScroller7: TPageScroller;
  160.     ToolBar5: TToolBar;
  161.     tbsUndo: TToolButton;
  162.     tbsRedo: TToolButton;
  163.     PageScroller8: TPageScroller;
  164.     ToolBar6: TToolBar;
  165.     tbsSuperScript: TToolButton;
  166.     tbsSubScript: TToolButton;
  167.     tbsInsertOrderedlist: TToolButton;
  168.     tbsInDent: TToolButton;
  169.     tbsOutDent: TToolButton;
  170.     PageScroller9: TPageScroller;
  171.     ToolBar7: TToolBar;
  172.     tbsCreateLink: TToolButton;
  173.     tbsInsertTable: TToolButton;
  174.     PageScroller10: TPageScroller;
  175.     ToolBar8: TToolBar;
  176.     tbsSelectAll: TToolButton;
  177.     PageScroller12: TPageScroller;
  178.     ToolBar10: TToolBar;
  179.     tbsJustifyFull: TToolButton;
  180.     tbsJustifyLeft: TToolButton;
  181.     tbsJustifyCenter: TToolButton;
  182.     tbsJustifyRight: TToolButton;
  183.     ActionManager: TActionManager;
  184.     Act_Exit: TAction;
  185.     Act_Help: TAction;
  186.     Act_About: TAction;
  187.     tbsInsertImage: TToolButton;
  188.     Act_M_ExampleWindow: TAction;
  189.     Act_M_ExampleButton: TAction;
  190.     procedure Act_BackColorExecute(Sender: TObject);
  191.     procedure Act_BoldExecute(Sender: TObject);
  192.     procedure Act_ExitExecute(Sender: TObject);
  193.     procedure Act_FontNameExecute(Sender: TObject);
  194.     procedure Act_FontSizeExecute(Sender: TObject);
  195.     procedure Act_IndentExecute(Sender: TObject);
  196.     procedure Act_InsertImageExecute(Sender: TObject);
  197.     procedure Act_InsertOrderedListExecute(Sender: TObject);
  198.     procedure Act_ItalicExecute(Sender: TObject);
  199.     procedure Act_JustifyCenterExecute(Sender: TObject);
  200.     procedure Act_JustifyFullExecute(Sender: TObject);
  201.     procedure Act_JustifyLeftExecute(Sender: TObject);
  202.     procedure Act_JustifyRightExecute(Sender: TObject);
  203.     procedure Act_NewExecute(Sender: TObject);
  204.     procedure Act_OpenExecute(Sender: TObject);
  205.     procedure Act_OutdentExecute(Sender: TObject);
  206.     procedure Act_PasteExecute(Sender: TObject);
  207.     procedure Act_PrintExecute(Sender: TObject);
  208.     procedure Act_PrintPreviewExecute(Sender: TObject);
  209.     procedure Act_RedoExecute(Sender: TObject);
  210.     procedure Act_RemoveformatExecute(Sender: TObject);
  211.     procedure Act_SaveExecute(Sender: TObject);
  212.     procedure Act_SelectAllExecute(Sender: TObject);
  213.     procedure Act_UnderlineExecute(Sender: TObject);
  214.     procedure Act_UndoExecute(Sender: TObject);
  215.     procedure FormCreate(Sender: TObject);
  216.     procedure cbbFontNameKeyPress(Sender: TObject; var Key: Char);
  217.     procedure btnExecClick(Sender: TObject);
  218.     procedure chkReadOnlyClick(Sender: TObject);
  219.     procedure btnSendClick(Sender: TObject);
  220.     procedure cbbFontNameChange(Sender: TObject);
  221.     procedure sedtFontSizeChange(Sender: TObject);
  222.     procedure Act_SaveAsExecute(Sender: TObject);
  223.     procedure Act_SaveToExecute(Sender: TObject);
  224.     procedure Act_PageSetupExecute(Sender: TObject);
  225.     procedure Act_ClearExecute(Sender: TObject);
  226.     procedure Act_WriteExecute(Sender: TObject);
  227.     procedure Act_CopyExecute(Sender: TObject);
  228.     procedure Act_CutExecute(Sender: TObject);
  229.     procedure Act_InsertExecute(Sender: TObject);
  230.     procedure Act_AppendExecute(Sender: TObject);
  231.     procedure Act_ViewSourceExecute(Sender: TObject);
  232.     procedure Act_ViewTextExecute(Sender: TObject);
  233.     procedure Act_Edit_BackColoerExecute(Sender: TObject);
  234.     procedure Act_Edit_BoldExecute(Sender: TObject);
  235.     procedure Act_Edit_CreateLinkExecute(Sender: TObject);
  236.     procedure Act_Edit_HorizontalRuleExecute(Sender: TObject);
  237.     procedure Act_Edit_ForeColorExecute(Sender: TObject);
  238.     procedure Act_Edit_InsertImageExecute(Sender: TObject);
  239.     procedure Act_Edit_InsertLineBreakExecute(Sender: TObject);
  240.     procedure Act_Edit_InsertOrderedlistExecute(Sender: TObject);
  241.     procedure Act_Edit_InsertTableExecute(Sender: TObject);
  242.     procedure Act_Edit_InsertUnOrderedListExecute(Sender: TObject);
  243.     procedure Act_Edit_JustifyCenterExecute(Sender: TObject);
  244.     procedure Act_Edit_JustifyFullExecute(Sender: TObject);
  245.     procedure Act_Edit_JustifyLeftExecute(Sender: TObject);
  246.     procedure Act_Edit_JustifyRightExecute(Sender: TObject);
  247.     procedure Act_Edit_ItalicExecute(Sender: TObject);
  248.     procedure Act_Edit_RemoveFormatExecute(Sender: TObject);
  249.     procedure Act_Edit_ScrollToBottomExecute(Sender: TObject);
  250.     procedure Act_Edit_ScrollToTopExecute(Sender: TObject);
  251.     procedure Act_Edit_OutDentExecute(Sender: TObject);
  252.     procedure Act_Edit_InDentExecute(Sender: TObject);
  253.     procedure Act_Edit_SuperScriptExecute(Sender: TObject);
  254.     procedure Act_Edit_SubScriptExecute(Sender: TObject);
  255.     procedure Act_Edit_UnderLineExecute(Sender: TObject);
  256.     procedure Act_Edit_StrikeThroughExecute(Sender: TObject);
  257.     procedure Act_M_ExampleWindowExecute(Sender: TObject);
  258.     procedure Act_M_ExampleButtonExecute(Sender: TObject);
  259.   end;
  260. var
  261.   HtmlEditForm: THtmlEditForm;
  262. implementation
  263. uses uMD5, MSHTML;
  264. {$R *.dfm}
  265. {
  266. ******************************** THtmlEditForm *********************************
  267. }
  268. procedure THtmlEditForm.Act_BackColorExecute(Sender: TObject);
  269. begin
  270.   //  if dlgColor1.Execute then
  271.   //    HtmlEdit.Command.BackColor(dlgColor1.Color);
  272. end;
  273. procedure THtmlEditForm.Act_BoldExecute(Sender: TObject);
  274. begin
  275.   HtmlEdit.Edit.Bold;
  276. end;
  277. procedure THtmlEditForm.Act_ExitExecute(Sender: TObject);
  278. begin
  279.   Close;
  280. end;
  281. procedure THtmlEditForm.Act_FontNameExecute(Sender: TObject);
  282. begin
  283.   if cbFontName.Text <> '' then
  284.     HtmlEdit.Edit.FontName(cbFontName.Text);
  285. end;
  286. procedure THtmlEditForm.Act_FontSizeExecute(Sender: TObject);
  287. begin
  288.   HtmlEdit.Edit.FontSize(cbFontSize.ItemIndex + 1);
  289. end;
  290. procedure THtmlEditForm.Act_IndentExecute(Sender: TObject);
  291. begin
  292.   HtmlEdit.Edit.Indent;
  293. end;
  294. procedure THtmlEditForm.Act_InsertImageExecute(Sender: TObject);
  295. begin
  296.   if dlgOpenPic.Execute then
  297.     HtmlEdit.Edit.InsertImage(dlgOpenPic.FileName);
  298. end;
  299. procedure THtmlEditForm.Act_InsertOrderedListExecute(Sender: TObject);
  300. begin
  301.   HtmlEdit.Edit.InsertOrderedList;
  302. end;
  303. procedure THtmlEditForm.Act_ItalicExecute(Sender: TObject);
  304. begin
  305.   HtmlEdit.Edit.Italic;
  306. end;
  307. procedure THtmlEditForm.Act_JustifyCenterExecute(Sender: TObject);
  308. begin
  309.   HtmlEdit.Edit.JustifyCenter;
  310. end;
  311. procedure THtmlEditForm.Act_JustifyFullExecute(Sender: TObject);
  312. begin
  313.   HtmlEdit.Edit.JustifyFull;
  314. end;
  315. procedure THtmlEditForm.Act_JustifyLeftExecute(Sender: TObject);
  316. begin
  317.   HtmlEdit.Edit.JustifyLeft;
  318. end;
  319. procedure THtmlEditForm.Act_JustifyRightExecute(Sender: TObject);
  320. begin
  321.   HtmlEdit.Edit.JustifyRight;
  322. end;
  323. procedure THtmlEditForm.Act_NewExecute(Sender: TObject);
  324. begin
  325.   HtmlEdit.New;
  326. end;
  327. procedure THtmlEditForm.Act_OpenExecute(Sender: TObject);
  328. begin
  329.   if dlgOpen.Execute then
  330.     HtmlEdit.Open(dlgOpen.FileName);
  331. end;
  332. procedure THtmlEditForm.Act_OutdentExecute(Sender: TObject);
  333. begin
  334.   HtmlEdit.Edit.Outdent;
  335. end;
  336. procedure THtmlEditForm.Act_PasteExecute(Sender: TObject);
  337. begin
  338.   HtmlEdit.Paste;
  339. end;
  340. procedure THtmlEditForm.Act_PrintExecute(Sender: TObject);
  341. begin
  342.   HtmlEdit.Print;
  343. end;
  344. procedure THtmlEditForm.Act_PrintPreviewExecute(Sender: TObject);
  345. begin
  346.   HtmlEdit.PrintPreview;
  347. end;
  348. procedure THtmlEditForm.Act_RedoExecute(Sender: TObject);
  349. begin
  350.   HtmlEdit.Redo;
  351. end;
  352. procedure THtmlEditForm.Act_RemoveformatExecute(Sender: TObject);
  353. begin
  354.   HtmlEdit.Edit.Removeformat;
  355. end;
  356. procedure THtmlEditForm.Act_SaveExecute(Sender: TObject);
  357. begin
  358.   HtmlEdit.Save;
  359. end;
  360. procedure THtmlEditForm.Act_SelectAllExecute(Sender: TObject);
  361. begin
  362.   HtmlEdit.SelectAll;
  363. end;
  364. procedure THtmlEditForm.Act_UnderlineExecute(Sender: TObject);
  365. begin
  366.   HtmlEdit.Edit.Underline;
  367. end;
  368. procedure THtmlEditForm.Act_UndoExecute(Sender: TObject);
  369. begin
  370.   HtmlEdit.Undo;
  371. end;
  372. procedure THtmlEditForm.FormCreate(Sender: TObject);
  373.   procedure ClearFontName;
  374.   var
  375.     i: integer;
  376.   begin
  377.     for i := cbbFontName.Items.Count - 1 downto 0 do
  378.     begin
  379.       if Pos('@', cbbFontName.Items[i]) = 1 then
  380.         cbbFontName.Items.Delete(i);
  381.     end;
  382.     for i := cbFontName.Items.Count - 1 downto 0 do
  383.     begin
  384.       if Pos('@', cbFontName.Items[i]) = 1 then
  385.         cbFontName.Items.Delete(i);
  386.     end;
  387.   end;
  388. begin
  389.   Self.BorderIcons := [biSystemMenu, biMinimize];
  390.   Self.BorderStyle := bsSingle;
  391.   pgc2.ActivePageIndex := 0;
  392.   cbbFontName.Items.AddStrings(Screen.Fonts);
  393.   cbFontName.Items.AddStrings(Screen.Fonts);
  394.   ClearFontName;
  395.   HtmlEditRecv.ReadOnly := TRUE;
  396.   HtmlEdit.ImageFolder := ExtractFilePath(Application.ExeName) + 'Image';
  397. end;
  398. {
  399. Cut 将当前选中区复制到剪贴板并删除之。
  400. Copy 将当前选中区复制到剪贴板。
  401. Paste 用剪贴板内容覆盖当前选中区。
  402. Delete 删除当前选中区。
  403. Removeformat 从当前选中区中删除格式化标签。
  404. --
  405. Redo 目前尚未支持
  406. Undo 目前尚未支持。
  407. --
  408. SelectAll 选中整个文档。
  409. Unselect 清除当前选中区的选中状态。
  410. --
  411. Indent 增加选中文本的缩进。
  412. Outdent 减少选中区所在格式化块的缩进。
  413. InsertOrderedList 切换当前选中区是编号列表还是常规格式化块。
  414. --
  415. Bold 切换当前选中区的粗体显示与否。
  416. Italic 切换当前选中区斜体显示与否。
  417. Underline 切换当前选中区的下划线显示与否。
  418. --
  419. FontName 设置或获取当前选中区的字体。
  420. FontSize 设置或获取当前选中区的字体大小。
  421. ForeColor 设置或获取当前选中区的前景(文本)颜色。 )
  422. BackColor 设置或获取当前选中区的背景颜色。
  423. --
  424. JustifyCenter 将当前选中区在所在格式化块置中。
  425. JustifyLeft 将当前选中区所在格式化块左对齐。
  426. JustifyRight 将当前选中区所在格式化块右对齐。
  427. CreateLink 在当前选中区上插入超级链接,或显示一个对话框允许用户指定要为当前选中区插入的超级链接的 URL。
  428. InsertImage 用图像覆盖当前选中区。
  429. OverWrite 切换文本状态的插入和覆盖。
  430. Print 打开打印对话框以便用户可以打印当前页。
  431. SaveAs 将当前 Web 页面保存为文件。
  432. Unlink 从当前选中区中删除全部超级链接。
  433. }
  434. procedure THtmlEditForm.cbbFontNameKeyPress(Sender: TObject;
  435.   var Key: Char);
  436. begin
  437.   Key := #0;
  438. end;
  439. procedure THtmlEditForm.btnExecClick(Sender: TObject);
  440. begin
  441.   HtmlEdit.Edit.Format(Trim(edt1.Text));
  442. end;
  443. procedure THtmlEditForm.chkReadOnlyClick(Sender: TObject);
  444. begin
  445.   HtmlEdit.ReadOnly := chkReadOnly.Checked;
  446. end;
  447. procedure THtmlEditForm.btnSendClick(Sender: TObject);
  448. begin
  449.   //  HtmlEdit1.Add(HtmlEdit.HTML);
  450.   //  HtmlEdit1.Add('/BR');
  451.   HtmlEditRecv.Append(HtmlEdit.HTML);
  452.   HtmlEdit.Clear;
  453.   HtmlEditRecv.Edit.ScrollToBottom;
  454. end;
  455. procedure THtmlEditForm.cbbFontNameChange(Sender: TObject);
  456. begin
  457.   if cbbFontName.Text <> '' then
  458.     HtmlEdit.Edit.FontName(cbbFontName.Text);
  459. end;
  460. procedure THtmlEditForm.sedtFontSizeChange(Sender: TObject);
  461. begin
  462.   HtmlEdit.Edit.FontSize(sedtFontSize.Value);
  463. end;
  464. procedure THtmlEditForm.Act_SaveAsExecute(Sender: TObject);
  465. begin
  466.   HtmlEdit.SaveAs;
  467. end;
  468. procedure THtmlEditForm.Act_SaveToExecute(Sender: TObject);
  469. begin
  470.   if dlgSave.Execute then
  471.     HtmlEdit.SaveToFile(dlgSave.FileName);
  472. end;
  473. procedure THtmlEditForm.Act_PageSetupExecute(Sender: TObject);
  474. begin
  475.   HtmlEdit.PrintPageSetup;
  476. end;
  477. procedure THtmlEditForm.Act_ClearExecute(Sender: TObject);
  478. begin
  479.   HtmlEdit.Clear;
  480. end;
  481. procedure THtmlEditForm.Act_WriteExecute(Sender: TObject);
  482. var
  483.   strTable: string;
  484.   RowCnt, ColCnt: integer;
  485. begin
  486.   strTable := '<TABLE border=1 >';
  487.   for RowCnt := 1 to 3 do
  488.   begin
  489.     strTable := strTable + '<TR>';
  490.     for ColCnt := 1 to 5 do
  491.       strTable := strTable + '<TD>&nbsp;</TD>';
  492.     strTable := strTable + '</TR>';
  493.   end;
  494.   strTable := strTable + '</TABLE>';
  495.   HtmlEdit.Write(strTable);
  496. end;
  497. procedure THtmlEditForm.Act_CopyExecute(Sender: TObject);
  498. begin
  499.   HtmlEdit.Copy;
  500. end;
  501. procedure THtmlEditForm.Act_CutExecute(Sender: TObject);
  502. begin
  503.   HtmlEdit.Cut;
  504. end;
  505. procedure THtmlEditForm.Act_InsertExecute(Sender: TObject);
  506. begin
  507.   HtmlEditRecv.Insert(HtmlEdit.HTML);
  508.   HtmlEdit.Clear;
  509. end;
  510. procedure THtmlEditForm.Act_AppendExecute(Sender: TObject);
  511. begin
  512.   HtmlEditRecv.Append(HtmlEdit.HTML);
  513.   HtmlEdit.Clear;
  514. end;
  515. procedure THtmlEditForm.Act_ViewSourceExecute(Sender: TObject);
  516. begin
  517.   mmo1.Clear;
  518.   mmo1.Lines.Text := HtmlEdit.HTML;
  519.   pgc2.ActivePageIndex := 1;
  520. end;
  521. procedure THtmlEditForm.Act_ViewTextExecute(Sender: TObject);
  522. begin
  523.   mmo1.Clear;
  524.   mmo1.Lines.Text := HtmlEdit.Text;
  525.   pgc2.ActivePageIndex := 1;
  526. end;
  527. procedure THtmlEditForm.Act_Edit_BackColoerExecute(Sender: TObject);
  528. begin
  529.   if dlgColor1.Execute then
  530.     HtmlEdit.Edit.BackColor(dlgColor1.Color);
  531. end;
  532. procedure THtmlEditForm.Act_Edit_BoldExecute(Sender: TObject);
  533. begin
  534.   HtmlEdit.Edit.Bold;
  535. end;
  536. procedure THtmlEditForm.Act_Edit_CreateLinkExecute(Sender: TObject);
  537. begin
  538.   HtmlEdit.Edit.CreateLink;
  539. end;
  540. procedure THtmlEditForm.Act_Edit_HorizontalRuleExecute(Sender: TObject);
  541. begin
  542.   HtmlEdit.Edit.InsertHorizontalRule;
  543. end;
  544. procedure THtmlEditForm.Act_Edit_ForeColorExecute(Sender: TObject);
  545. begin
  546.   if dlgColor1.Execute then
  547.     HtmlEdit.Edit.ForeColor(dlgColor1.Color);
  548. end;
  549. procedure THtmlEditForm.Act_Edit_InsertImageExecute(Sender: TObject);
  550. begin
  551.   if dlgOpenPic.Execute then
  552.     HtmlEdit.Edit.InsertImage(dlgOpenPic.FileName);
  553. end;
  554. procedure THtmlEditForm.Act_Edit_InsertLineBreakExecute(Sender: TObject);
  555. begin
  556.   HtmlEdit.Edit.InsertLineBreak;
  557. end;
  558. procedure THtmlEditForm.Act_Edit_InsertOrderedlistExecute(Sender: TObject);
  559. begin
  560.   HtmlEdit.Edit.InsertOrderedList;
  561. end;
  562. procedure THtmlEditForm.Act_Edit_InsertTableExecute(Sender: TObject);
  563. begin
  564.   HtmlEdit.Edit.InsertTable(StrToInt(edt2.Text), StrToInt(edt3.Text));
  565. end;
  566. procedure THtmlEditForm.Act_Edit_InsertUnOrderedListExecute(
  567.   Sender: TObject);
  568. begin
  569.   HtmlEdit.Edit.InsertUnOrderedList;
  570. end;
  571. procedure THtmlEditForm.Act_Edit_JustifyCenterExecute(Sender: TObject);
  572. begin
  573.   HtmlEdit.Edit.JustifyCenter;
  574. end;
  575. procedure THtmlEditForm.Act_Edit_JustifyFullExecute(Sender: TObject);
  576. begin
  577.   HtmlEdit.Edit.JustifyFull;
  578. end;
  579. procedure THtmlEditForm.Act_Edit_JustifyLeftExecute(Sender: TObject);
  580. begin
  581.   HtmlEdit.Edit.JustifyLeft;
  582. end;
  583. procedure THtmlEditForm.Act_Edit_JustifyRightExecute(Sender: TObject);
  584. begin
  585.   HtmlEdit.Edit.JustifyRight;
  586. end;
  587. procedure THtmlEditForm.Act_Edit_ItalicExecute(Sender: TObject);
  588. begin
  589.   HtmlEdit.Edit.Italic;
  590. end;
  591. procedure THtmlEditForm.Act_Edit_RemoveFormatExecute(Sender: TObject);
  592. begin
  593.   HtmlEdit.Edit.RemoveFormat;
  594. end;
  595. procedure THtmlEditForm.Act_Edit_ScrollToBottomExecute(Sender: TObject);
  596. begin
  597.   HtmlEdit.Edit.ScrollToBottom;
  598. end;
  599. procedure THtmlEditForm.Act_Edit_ScrollToTopExecute(Sender: TObject);
  600. begin
  601.   HtmlEdit.Edit.ScrollToTop;
  602. end;
  603. procedure THtmlEditForm.Act_Edit_OutDentExecute(Sender: TObject);
  604. begin
  605.   HtmlEdit.Edit.OutDent;
  606. end;
  607. procedure THtmlEditForm.Act_Edit_InDentExecute(Sender: TObject);
  608. begin
  609.   HtmlEdit.Edit.InDent;
  610. end;
  611. procedure THtmlEditForm.Act_Edit_SuperScriptExecute(Sender: TObject);
  612. begin
  613.   HtmlEdit.Edit.SuperScript;
  614. end;
  615. procedure THtmlEditForm.Act_Edit_SubScriptExecute(Sender: TObject);
  616. begin
  617.   HtmlEdit.Edit.SubScript;
  618. end;
  619. procedure THtmlEditForm.Act_Edit_UnderLineExecute(Sender: TObject);
  620. begin
  621.   HtmlEdit.Edit.UnderLine;
  622. end;
  623. procedure THtmlEditForm.Act_Edit_StrikeThroughExecute(Sender: TObject);
  624. begin
  625.   HtmlEdit.Edit.StrikeThrough;
  626. end;
  627. procedure THtmlEditForm.Act_M_ExampleWindowExecute(Sender: TObject);
  628. begin
  629.   pgc2.ActivePageIndex := 0;
  630. end;
  631. procedure THtmlEditForm.Act_M_ExampleButtonExecute(Sender: TObject);
  632. begin
  633.   pgc2.ActivePageIndex := 1;
  634. end;
  635. end.