⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tut33.html

📁 WINDOWS程序员使用指南--汇编基础
💻 HTML
📖 第 1 页 / 共 5 页
字号:
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><font face="MS Sans Serif" size="-1">hidden text</font></td>
    <td> 
      <div align="center"><font face="MS Sans Serif" size="-1"></font></div>
    </td>
    <td> 
      <div align="center"><font face="MS Sans Serif" size="-1"></font></div>
    </td>
    <td> 
      <div align="center"><font face="MS Sans Serif" size="-1">x</font></div>
    </td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><font face="MS Sans Serif" size="-1">font binding</font></td>
    <td> 
      <div align="center"><font face="MS Sans Serif" size="-1"></font></div>
    </td>
    <td> 
      <div align="center"><font face="MS Sans Serif" size="-1"></font></div>
    </td>
    <td> 
      <div align="center"><font face="MS Sans Serif" size="-1">x</font></div>
    </td>
  </tr>
</table>
<p align="left"><font face="Tahoma" size="-1">The above table is by no means comprehensive: 
  I only list the important features.</font></p>
<h3 align="left"><font face="Times New Roman, Times, serif" color="#3333CC">Creating 
  the richedit control</font><font face="Tahoma"> </font></h3>
<p align="left"><font face="MS Sans Serif" size="-1">After loading the richedit 
  dll, you can call <font color="#666600"><b>CreateWindowEx</b></font> to create 
  the control. You can use edit control styles and common window styles in <font color="#006600"><b>CreateWindowEx</b></font> 
  except <font color="#000066"><b>ES_LOWERCASE, ES_UPPERCASE and ES_OEMCONVERT</b></font>.</font></p>
<pre align="left"><font face="Tahoma"><b><font color="#660066">.const
	RichEditID equ 300
.data
	</font></b></font><b><font color="#660066"><font face="Tahoma">RichEditDLL db &quot;RichEd20.dll&quot;,0<br>	RichEditClass db &quot;RichEdit20A&quot;,0
	...
.data?<br>	hRichEditDLL dd ?
	hwndRichEdit dd ?
.code</font></font><font face="Tahoma">
	.....
	invoke <font color="#336600">LoadLibrary</font>,addr RichEditDLL
	mov hRichEditDLL,eax<br>	invoke <font color="#336600">CreateWindowEx</font>,0,addr RichEditClass,WS_VISIBLE or ES_MULTILINE or WS_CHILD or WS_VSCROLL or WS_HSCROLL, \
										CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,hWnd,RichEditID,hInstance,0
	mov hwndRichEdit,eax</font></b></pre>
<h3 align="left"><font face="Times New Roman, Times, serif" color="#3333CC">Setting 
  default text and background color</font></h3>
<p align="left"><font face="Tahoma" size="-1"> You may have the problem with setting 
  text color and the background color of the edit control. But this problem has 
  been remedy in richedit control. To set the background color of the richedit 
  control, you send <font color="#006666"><b>EM_SETBKGNDCOLOR</b></font> to the 
  richedit control. This message has the following syntax.</font></p>
<p align="left"><font face="Tahoma" size="-1"> <font color="#990033"><b>wParam</b></font> 
  == color option. The value of 0 in this parameter specifies that Windows uses 
  the color value in <font color="#990033"><b>lParam</b></font> as the background 
  color. If this value is nonzero, Windows uses the Windows system background 
  color. Since we send this message to change the background color, we must pass 
  0 in wParam.<br>
  <font color="#990033"><b>lParam</b></font> == specifies the <font color="#003366"><b>COLORREF</b></font> 
  structure of the color you want to set if wParam is 0.</font></p>
<p align="left"><font face="Tahoma" size="-1"> For example, if I want to set the 
  background color to pure blue, I would issue this following line:</font></p>
<pre align="left"><font face="Tahoma">		<font color="#330066"><b>invoke SendMessage,hwndRichEdit,EM_SETBKGNDCOLOR,0,0FF0000h</b></font></font><font face="Tahoma"></font></pre>
<p align="left"><font face="Tahoma" size="-1">To set the text color, richedit 
  control provides another new message, <font color="#660066"><b>EM_SETCHARFORMAT</b></font>, 
  for the job. This message controls the text formatting of a range to characters 
  in selection or all text in the control. This message has the following syntax:</font></p>
<p align="left"><font face="Tahoma" size="-1"> <font color="#0000FF"><b>wParam</b></font> 
  == formatting options: </font></p>
<table cellpadding="3" align="center" border="1">
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">SCF_ALL</font></b></td>
    <td><font face="MS Sans Serif" size="-1">The operation affects all text in 
      the control.</font></td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">SCF_SELECTION</font></b></td>
    <td><font face="MS Sans Serif" size="-1">The operation affects only the text 
      in selection</font></td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">SCF_WORD or SCF_SELECTION</font></b></td>
    <td><font face="MS Sans Serif" size="-1">Affects the word in selection. If 
      the selection is empy, ie, only the caret is in the word, the operation 
      affects that word. <b>SCF_WORD</b> flag must be used with <b>SCF_SELECTION</b>.</font></td>
  </tr>
</table>
<p align="left"><font face="Tahoma" size="-1"> <font color="#0000FF"><b>lParam</b></font> 
  == pointer to a <font color="#990099"><b>CHARFORMAT</b></font> or <font color="#990099"><b>CHARFORMAT2</b></font> 
  structure that specifies the text formatting to be applied. <font color="#990099"><b>CHARFORMAT2</b></font> 
  is available for richedit 2.0 and above only. This doesn't mean that you must 
  use <font color="#990099"><b>CHARFORMAT2</b></font> with RichEdit 2.0 or above. 
  You can still use <font color="#990099"><b>CHARFORMAT</b></font> if the added 
  features in <font color="#990099"><b>CHARFORMAT2</b></font> are not necessary 
  for your need.</font></p>
<blockquote> 
  <blockquote>
    <pre align="left"><font face="Tahoma"><b><font color="#006666">CHARFORMATA STRUCT 
	cbSize DWORD ? 
	dwMask DWORD ? 
	dwEffects DWORD    ? 
	yHeight DWORD ? 
	yOffset DWORD ? 
	crTextColor COLORREF ? 
	bCharSet BYTE ? 
	bPitchAndFamily    BYTE ? 
	szFaceName BYTE LF_FACESIZE dup(?) 
	_wPad2 WORD ? 
CHARFORMATA ENDS </font></b></font></pre>
  </blockquote>
</blockquote>
<table cellpadding="3" align="center" border="1">
  <tr bgcolor="#CCFFCC"> 
    <th nowrap><b><font face="MS Sans Serif" size="-1">Field Name</font></b></th>
    <th nowrap><font face="MS Sans Serif" size="-1">Description</font></th>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">cbSize</font></b></td>
    <td><font face="MS Sans Serif" size="-1">The size of the structure. RichEdit 
      control uses this field to determine the version of the structure whether 
      it is <font color="#003366"><b>CHARFORMAT</b></font> or <font color="#000066"><b>CHARFORMAT2</b></font></font></td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">dwMask</font></b></td>
    <td> 
      <p><font face="MS Sans Serif" size="-1">Bit flags that determine which of 
        the following members are valid.</font></p>
      <table cellpadding="3" border="1" align="center">
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_BOLD</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The <font color="#000066"><b>CFE_BOLD</b></font> 
            value of the <font color="#000066"><b>dwEffects</b></font> member 
            is valid</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_CHARSET</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The <font color="#000066"><b>bCharSet</b></font> 
            member is valid.</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_COLOR</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The <font color="#000066"><b>crTextColor</b></font> 
            member and the <font color="#000066"><b>CFE_AUTOCOLOR</b></font> value 
            of the <font color="#000066"><b>dwEffects</b></font> member are valid</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_FACE</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The <font color="#000066"><b>szFaceName</b></font> 
            member is valid.</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_ITALIC</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The <font color="#000066"><b>CFE_ITALIC</b></font> 
            value of the <font color="#000066"><b>dwEffects</b></font> member 
            is valid</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_OFFSET</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The <font color="#000066"><b>yOffset 
            </b></font>member is valid</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_PROTECTED</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The<font color="#000066"><b> 
            CFE_PROTECTED</b></font> value of the <font color="#000066"><b>dwEffects</b></font> 
            member is valid</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_SIZE</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The <font color="#000066"><b>yHeight</b></font> 
            member is valid</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_STRIKEOUT</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The <font color="#000066"><b>CFE_STRIKEOUT</b></font> 
            value of the <font color="#000066"><b>dwEffects</b></font> member 
            is valid.</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFM_UNDERLINE</font></b></td>
          <td><font face="MS Sans Serif" size="-1">The <font color="#000066"><b>CFE_UNDERLINE</b></font> 
            value of the <font color="#000066"><b>dwEffects</b></font> member 
            is valid</font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">dwEffects</font></b></td>
    <td> 
      <p><font face="MS Sans Serif" size="-1">The character effects. Can be the 
        combination of the following values</font></p>
      <table cellpadding="3" align="center" border="1">
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFE_AUTOCOLOR</font></b></td>
          <td><font face="MS Sans Serif" size="-1">Use the system text color</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFE_BOLD</font></b></td>
          <td><font face="MS Sans Serif" size="-1">Characters are bold</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFE_ITALIC</font></b></td>
          <td><font face="MS Sans Serif" size="-1">Characters are italic</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFE_STRIKEOUT</font></b></td>
          <td><font face="MS Sans Serif" size="-1">Characters are struck.</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFE_UNDERLINE</font></b></td>
          <td><font face="MS Sans Serif" size="-1">Characters are underlined</font></td>
        </tr>
        <tr> 
          <td><b><font face="MS Sans Serif" size="-1">CFE_PROTECTED</font></b></td>
          <td><font face="MS Sans Serif" size="-1">Characters are protected; an 
            attempt to modify them will cause an <font color="#000066"><b>EN_PROTECTED</b></font> 
            notification message. </font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">yHeight</font></b></td>
    <td><font face="MS Sans Serif" size="-1">Character height, in twips (1/1440 
      of an inch or 1/20 of a printer's point). </font></td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">yOffset</font></b></td>
    <td><font face="MS Sans Serif" size="-1">Character offset, in twips, from 
      the baseline. If the value of this member is positive, the character is 
      a superscript; if it is negative, the character is a subscript. </font></td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">crTextColor </font></b></td>
    <td><font face="MS Sans Serif" size="-1">Text color. This member is ignored 
      if the CFE_AUTOCOLOR character effect is specified. </font></td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">bCharSet</font></b></td>
    <td><font face="MS Sans Serif" size="-1">Character set value</font></td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">bPitchAndFamily</font></b></td>
    <td><font face="MS Sans Serif" size="-1">Font family and pitch. </font></td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="MS Sans Serif" size="-1">szFaceName </font></b></td>
    <td><font face="MS Sans Serif" size="-1">Null-terminated character array specifying 
      the font name</font></td>
  </tr>
  <tr bgcolor="#FFFFCC"> 
    <td><b><font face="Tahoma" size="-1">_wPad2</font></b></td>
    <td><font face="MS Sans Serif" size="-1">Padding</font></td>
  </tr>
</table>
<p><font face="Tahoma" size="-1">From examination of the structure, you'll see 
  that we can change the text effects (bold,italic, strikeout,underline), text 
  color (<font color="#006666"><b>crTextColor</b></font>) and font face/size/character 
  set. A notable flag is <font color="#666600"><b>CFE_RPOTECTED</b></font>. The 
  text with this flag is marked as protected which means that when the user tries 
  to modify it, <font color="#666600"><b>EN_PROTECTED</b></font> notification 
  message will be sent to the parent window. And you can allow the change to happen 
  or not.</font></p>
<p><font face="Tahoma" size="-1"><b><font color="#006666">CHARFORMAT2</font></b> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -