当前位置:首页 > Windows程序 > 正文

Delphi WebBrowser控件的使用(大全 good)

2021-03-27 Windows程序

         在DownloadComplete事件中

 (wb_Editor.Document as IHTMLDocument2).execCommand(‘formatblock‘,False,‘<div>‘);
///选中文本编辑
///设置字体

//////名称        (WebBrowser1.Document as IHTMLDocument2).execCommand(‘FontName‘, False,‘宋体‘);
//////大小        (WebBrowser1.Document as IHTMLDocument2).execCommand(‘FontSize‘, False,7);///字体大小是从1到7
////样式 
//////粗体        (WebBrowser1.Document as IHTMLDocument2).execCommand(‘Bold‘, False,1);
//////斜体        (WebBrowser1.Document as IHTMLDocument2).execCommand(‘Italic‘, False,1);
/////下划线       (WebBrowser1.Document as IHTMLDocument2).execCommand(‘Underline‘, False,1);
/////删除线       (WebBrowser1.Document as IHTMLDocument2).execCommand(‘StrikeThrough‘, False,1);

///超链接          (WebBrowser1.Document as IHTMLDocument2).execCommand(‘CreateLink‘, False,1);
///删除超链接      (WebBrowser1.Document as IHTMLDocument2).execCommand(‘UnLink‘, False,1);

///设置
///设置文字前景色   (WebBrowser1.Document as IHTMLDocument2).execCommand(‘ForeColor‘,False,‘Red‘);
///设置文字背景色   (WebBrowser1.Document as IHTMLDocument2).execCommand(‘BackColor‘,False,‘Blue‘);

///设置下标        (WebBrowser1.Document as Ihtmldocument2).execCommand(‘SubScript‘,False,1);
///设置上标        (WebBrowser1.Document as Ihtmldocument2).execCommand(‘SuperScript‘,False,1);

///设置对齐方式
///设置左对齐       (WebBrowser1.Document as IHTMLDocument2).execCommand(‘JustifyLeft‘, False,0);
///设置中对齐       (WebBrowser1.Document as IHTMLDocument2).execCommand(‘JustifyCenter‘, False,0);
///设置右对齐       (WebBrowser1.Document as IHTMLDocument2).execCommand(‘JustifyRight‘, False,0);
///设置两端对齐     (WebBrowser1.Document as IHTMLDocument2).execCommand(‘JustifyFull‘, False,0);


///缩进
///向右缩进        (WebBrowser1.Document as Ihtmldocument2).execCommand(‘Indent‘,True,1);
///向左缩进        (WebBrowser1.Document as Ihtmldocument2).execCommand(‘Outdent‘,True,1);

///清除格式        (WebBrowser1.Document as Ihtmldocument2).execCommand(‘Removeformat‘,True,0);

///序列查看
///数字格式         (WebBrowser1.Document as Ihtmldocument2).execCommand(‘InsertOrderedList‘,True,0);
///圆点查看         (WebBrowser1.Document as Ihtmldocument2).execCommand(‘InsertUnorderedList‘,True,0);

///插入图片(静态)  (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertImage‘, True,‘‘);
                   (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertImage‘, False,‘C:\1.png‘);

 

///插入书签 (WebBrowser1.Document as Ihtmldocument2).execCommand(‘CreateBookmark‘,True,0);

///取消书签 (WebBrowser1.Document as Ihtmldocument2).execCommand(‘UnBookmark‘,True,0);
 
///插入HTML组件
///后面的字符串为这个控件的ID号
///直线          Line         (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertHorizontalRule‘, True,‘‘);
///按钮          Button       (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertButton‘, True,‘‘);
///复选框        CheckBox     (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertInputCheckbox‘, True,‘‘);
///单选框        Radio        (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertInputRadio‘, True,‘‘);
///编辑框        Edit         (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertInputText‘, True,‘‘);
///文本框        Memo         (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertTextArea‘, True,‘‘);
///密码框        PswEdit      (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertInputPassword‘, True,‘‘);
///组框架        GroupBox     (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertIFrame‘, True,‘‘);
///列表框        ListBox      (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertSelectListbox‘, True,‘‘);
///组合框        Combobox     (WebBrowser1.Document as IHTMLDocument2).execCommand(‘InsertSelectDropdown‘, True,‘‘);

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/68306.html