zoukankan      html  css  js  c++  java
  • delphi HTML代码

    ################################属性 设置################################################

    字体设置{
    //---------------------------------------------------------------------------------------
    字体名称  <FONT face=微软雅黑>This A Text</FONT>
    字体大小  <FONT size=1><SPAN style="FONT-SIZE: 100pt"><P>This A Text</P></SPAN></FONT>
    //---------------------------------------------------------------------------------------
    粗体      <STRONG>This A Text</STRONG>
    斜体      <EM>This A Text</EM>
    下划线    <U>This A Text</U>
    删除线    <S>This A Text</S>  
    //---------------------------------------------------------------------------------------
    字体颜色   <FONT color=#ff0000>This A Text</FONT>
    字体背景色 <FONT style="BACKGROUND-COLOR: #0000ff">This A Text</FONT>  
    //---------------------------------------------------------------------------------------
    }


    //--------------------------------------------------------------------------------------- 
    字体样式{
    HTML 代码  - 样式   设置 PasteHTML
    //如何获取

    普通             <p>This Is a Text</p>
    已编排格式       <pre>This Is a Text</pre>
    地址             <address>This Is a Text</address>
    标题1            <h1>This Is a Text</h1>
    标题2            <h2>This Is a Text</h2>
    标题3            <h3>This Is a Text</h3>
    标题4            <h4>This Is a Text</h4>
    标题5            <h5>This Is a Text</h5>
    标题6            <h6>This Is a Text</h6>
    带编号的列表     <ol><li><p>This Is a Text</p></li></ol>
    带项目符号的列表 <ul><li><p>This Is a Text</p></li></ul>
    目录列表         <dir><li><p>This Is a Text</p></li></dir>
    菜单列表         <menu><li><p>This Is a Text</p></li></menu>
    定义条目         <dl><dt><h2>This Is a Text</h2></dt></dl>
    定义             <dl><dd><h2>This Is a Text</h2></dd></dl>
    段落             <dl><dd><p>This Is a Text</p></dd></dl>
    }

    //--------------------------------------------------------------------------------------- 

    //--------------------------------------------------------------------------------------- 
    对齐方式{
    左    <P align=left>This Is A Text</P>
    中    <P align=center>This Is A Text</P>
    右    <P align=right>This Is A Text</P>
    两端  <p align="justify">This Is A Text</p>
    }

    //---------------------------------------------------------------------------------------

    //--------------------------------------------------------------------------------------- 
    序列{  
    数字序列    <OL><LI> This Is A Text</LI></OL>
    原点序列    <UL><LI> This Is A Text</LI></UL>
    }

    //--------------------------------------------------------------------------------------- 

    //--------------------------------------------------------------------------------------- 
    缩进{
    向右前进
    向左前进
    //--------------------------------------------------------------------------------------- 
    //向右缩进2次
      <BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
      <BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
        <P style="MARGIN-RIGHT: 0px" dir=ltr>This Is A Text</P></BLOCKQUOTE></BLOCKQUOTE>
    //文字已经到最左边了    
        <P style="MARGIN-RIGHT: 0px" dir=ltr>This Is A Text</P>

    //---------------------------------------------------------------------------------------     

    设置TAB大小   This Is A Text    //注 有几个   就表示TAB是几现在表示tab为2格
    }


    //--------------------------------------------------------------------------------------- 
    上标/下标{
    上标     <sup>aaaaaaaaa</sup>
    下标    <sub>aaaaaaaaa</sub>
    正常    清除样式 
    }

    //--------------------------------------------------------------------------------------- 

    WEB{
    WEB背景色         <BODY bgColor=#000080>
    WEB背景图片     <BODY background=C:1.jpg >


    }

    //--------------------------------------------------------------------------------------- 

    插入图片{
    <IMG border=0 hspace=0 alt="" align=baseline src="C:1.jpg">    


    }

    //--------------------------------------------------------------------------------------- 

    插入超链接{
    插入
    删除
    //title是提示信息
    //HTTPS https://
    <a href="https://www.baidu.com" title="提示信息">Hello</a>
    //FILE file://
    <a href="file://C:/1.avi" title="提示信息">Hello</a>
    //FTP ftp:///
    <a href="ftp:///C:/1.avi" title="提示信息">Hello</a>
    //HTTP  http:///
    <a href="http:///C:/1.avi" title="提示信息">Hello</a>
    //邮件 收件人  mailto:  MainTO OutLook Express
    <a href="mailto:123@1234.com" title="提示信息">Hello</a>
    //新闻 news:/
    <a href="news:/C:/1.avi" title="提示信息">Hello</a>
    //Telnet  telnet:/
    <a href="telnet:/C:/1.avi" title="提示信息">Hello</a>
    //其他 /
    <a href="/C:/1.avi" title="Hint ">Hello</a>
    }

    //--------------------------------------------------------------------------------------- 

    插入书签{

    }

    //--------------------------------------------------------------------------------------- 

    插入多媒体{
    media
    real
    flash
    }


    //--------------------------------------------------------------------------------------- 

    插入表格{


    }

    //--------------------------------------------------------------------------------------- 

    //--------------------------------------------------------------------------------------- 
    HTML组件的插入{

    }


    //--------------------------------------------------------------------------------------- 
    //新建1个空的文档

    //--------------------------------------------------------------------------------------- 
    文件{
    新建文档
    保存文档
    另存文档
    打开文档
    打印
    打印预览
    页面设置
    查看文档源文件
    写入源文件
    }



    编辑{
    撤销
    重做
    复制
    粘贴
    删除
    全选
    剪切
    查找
    替换
    }

    //--------------------------------------------------------------------------------------- 
    状态{
    文档标题
    文档是否被修改
    文档大小
    选中的文本
    设置选中的文本


    }

    //--------------------------------------------------------------------------------------- 

    ################################属性 获得################################################











    //--------------------------------------------------------------------------------------- 
    //--------------------------------------------------------------------------------------- 
    使用方法
    1 获得当前选中文本的位置
    2 使用粘贴HTML代码的方式实现功能
    3 完成命令后再次选中原来选中的文本



    //--------------------------------------------------------------------------------------- 
    //获得当前选中的文本
    function GetSelText():string;
    begin
      Result:=( (Form1.WebBrowser1.Document as IHTMLDocument2).selection.createRange as IHtmlTxtRange).text;
    end;
    //--------------------------------------------------------------------------------------- 
    //粘贴HTML代码
    procedure SetSelHtmlText(s:string);
    begin
      ( (Form1.WebBrowser1.Document as IHTMLDocument2).selection.createRange as IHtmlTxtRange).pasteHTML(s);
    end;
    //--------------------------------------------------------------------------------------- 
    //设置文本被选中 
    procedure SetSelection(Start,Length:integer);
    var
      TextRange:IHtmlTxtRange;
      Doc: IHtmlDocument2;
    begin
      (Form1.WebBrowser1.Document as IHTMLDocument2).selection.empty;
      TextRange:=(Form1.WebBrowser1.Document as IHTMLDocument2).selection.createRange as IHtmlTxtRange;
      TextRange.collapse(true);
      TextRange.moveEnd('character',Start+Length);
      TextRange.moveStart('character',Start);
      TextRange.select;
    end;
    //--------------------------------------------------------------------------------------- 
    //获得文本被选中位置



    //--------------------------------------------------------------------------------------- 
    //设置HTML为正常
    这个用获得属性来实现


    //---------------------------------------------------------------------------------------




  • 相关阅读:
    Ubuntu格式化分区时的一个小错误
    VS 2013中的新特性browser link
    回车登录,兼容
    ASP.NET MVC 站点设置.html 为起始页
    WebBrowser 禁用右键
    C# 获取时间差(几天前,几小时前,几分钟前,几秒前)
    JavaScrip操作Cookie
    JS生成GUID算法
    老李推荐: 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例 4
    老李推荐: 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例 3
  • 原文地址:https://www.cnblogs.com/xe2011/p/3885603.html
Copyright © 2011-2022 走看看