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

📄 ch11.htm

📁 VC使用大全。里面集合了VC使用的各种使用技巧。非常有用。
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<ol> 

<li><P> Change the # footnote to <B><font color="#008000">HID_TOOLS_OPTIONS</font></B>.</P>

<li><P> Change the K keyword. There are several keywords that should lead here, and each needs to be separated from the next by a semicolon (;). Some need to be two-level keywords with the levels separated by commas. A good first start is <B><font 
color="#008000">string, changing;color, changing;centering, </font></B><B><font color="#008000">changing;appearance, controlling</font></B>.</P>

<li><P> Change the $ keyword to <B><font color="#008000">Tools Options command</font></B>.</P>

<li><P> Change the first line of the topic to <B><font color="#008000">Options command (Tools menu)</font></B>.</P>

<li><P> Delete the rest of the topic and replace it with a short description of this menu item. The following text is OK:</P>

<pre><font color="#008000">Use this command to change the appearance of the ShowString </font></pre>

<pre><font color="#008000">display with the Options dialog box. The string being displayed, </font></pre>

<pre><font color="#008000">color of the text, and vertical and horizontal centering are </font></pre>

<pre><font color="#008000">all controlled from this dialog.</font></pre>

</ol>

<P>If you want to test this, too, save the files in Word, compile the Help project, run ShowString, and choose <U>T</U>ools. Highlight the <U>O</U>ptions item by moving the highlight with the cursor keys, but do not click <U>O</U>ptions to select it; 
press <font color="#008000">F1</font> instead. Figure 11.10 shows the Help window that displays.</P>

<A HREF="Mfigs10.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs10.gif"><b>Fig. 11.10</b></A>

<P><I>The new Tools Options Help is reached by pressing F1 while the item is highlighted on the menu.</I></P>

<P>Each Control on the Options Dialog</P>

<P>Copy the File New topic into <font color="#008000">ShowString.rtf</font> again and cut it down drastically. To do this, follow these steps:</P>

<ol>

<li><P> Remove the K and $ footnotes.</P>

<li><P> Change the # footnote to <B><font color="#008000">HIDD_OPTIONS</font></B>.</P>

<li><P> Change the first line to <B><font color="#008000">(Options dialog)</font></B>.</P>

<li><P> Delete the other text in the topic.</P>

</ol>

<P>Copy this block into the Clipboard and paste it in seven more times, so that you have a skeleton for each control on the dialog box. Remember to copy the page break before or after the topic, too. Then edit each skeleton to document the following topic 
IDs:</P>

<ul>

<li> <font color="#008000">HIDD_OPTIONS_STRING</font>

<li> <font color="#008000">HIDD_OPTIONS_BLACK</font>

<li> <font color="#008000">HIDD_OPTIONS_RED</font>

<li> <font color="#008000">HIDD_OPTIONS_GREEN</font>

<li> <font color="#008000">HIDD_OPTIONS_HORIZCENTER</font>

<li> <font color="#008000">HIDD_OPTIONS_VERTCENTER</font>

<li> <font color="#008000">HIDD_OPTIONS_OK</font>

<li> <font color="#008000">HIDD_OPTIONS_CANCEL</font>

</ul>

<P>Change the topic ID and add a sentence or two of text. Be consistent. The samples included with this chapter are all a single sentence that starts with an imperative verb like &quot;Click&quot; or &quot;Select&quot; and ends with a period (.). If you 
would rather choose a different style for your pop-up boxes, use the same style for all of them. It confuses the user if pop-up boxes are inconsistent and tends to make them believe your coding is sloppy, too.</P>

<P>To test your work, compile <font color="#008000">ShowString.hpj</font> again, run ShowString, and choose <U>T</U>ools, <U>O</U>ptions. Click the question mark button and then click somewhere on the dialog box. Explore each of the controls to be sure 
you have entered the correct text. Figure 11.11 shows the context Help for the String edit box.</P>

<A HREF="Mfigs11.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs11.gif"><b>Fig. 11.11</b></A>

<P><I>Display Help for a dialog box control by clicking the Question button in the upper-right corner and then </I><I>clicking a control.</I></P>

<P>Understanding Centering</P>

<P>In <font color="#008000">ShowString.rtf</font>, paste in another copy of the File New topic. Make the following changes:</P>

<ol>

<li><P> Change the # footnote to <B><font color="#008000">HID_CENTERING</font></B> (the topic ID you added to <font color="#008000">ShowStringx.hm</font> and called in <font color="#008000">CShowStringApp::OnHelpUnderstandingcentering()</font>).</P>

<li><P> Change the K footnote to <B><font color="#008000">centering</font></B>.</P>

<li><P> Change the $ footnote to <B><font color="#008000">Understanding Centering</font></B>.</P>

<li><P> Change the title on the first line to <B><font color="#008000">Understanding Centering</font></B>.</P>

<li><P> Replace the text with a short explanation of centering, like this:</P>

<pre><font color="#008000">ShowString can center the displayed string within the view. The two</font></pre>

<pre><font color="#008000">options, &quot;center horizontally&quot; and &quot;center vertically&quot;, can be set </font></pre>

<pre><font color="#008000">independently on the Options dialog box, reached by choosing the Options </font></pre>

<pre><font color="#008000">item on the Tools menu. Text that is not centered horizontally is </font></pre>

<pre><font color="#008000">displayed at the left edge of the window. Text that is not centered </font></pre>

<pre><font color="#008000">vertically is displayed at the top of the window.</font></pre>

<li><P> Add links from the word <font color="#008000">Tools</font> to the <font color="#008000">menu_tools</font> topic and from the word <font color="#008000">Options</font> to <font color="#008000">HID_TOOLS_OPTIONS</font>, as before. Remember to watch 
for extra spaces.</P>

</ol>

<P>Test this change in the usual way, and when you choose <U>H</U>elp, <U>U</U>nderstanding Centering from the ShowString menus, you should see something like Figure 11.12. Try following the links; you can use the Back button to return to the centering 
topic.</P>

<A HREF="Mfigs12.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs12.gif"><b>Fig. 11.12</b></A>

<P><I>Display a teaching Help topic by choosing it from the </I><I><U>H</U></I><I>elp menu.</I></P>

<P><B>Changing the &quot;How to Modify Text&quot; topic</B></P>

<P>App Wizard already provided a How to Modify Text topic at the bottom of <font color="#008000">afxcore.rtf</font> that needs to be edited to explain how ShowString works. It displays when the user selects the view area for context Help. Replace the text 
with a much shorter explanation that tells the user to choose <U>T</U>ools, <U>O</U>ptions. To add a link to that topic (short though it is), type <B><font color="#008000">HID_TOOLS_OPTIONS</font></B> immediately after the word <font 
color="#008000">Options</font> in the Help topic. While you're at it, type <B><font color="#008000">menu_tools</font></B> immediately after the word <font color="#008000">Tools</font>. Select the word <font color="#008000">Options</font> and press 
Ctrl+Shift+D to double-underline it; then do the same for <font color="#008000">Tools</font>. Select <font color="#008000">HID_TOOLS_OPTIONS</font> and press Ctrl+Shift+H to hide it; then do the same for <font color="#008000">menu_tools</font>.</P>

<blockquote><p><img src="tip.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/tip.gif">

<P>If you've reassigned these keys, you can do the formatting the long way. To double-underline text, select it and choose <U>F</U>ormat, <U>F</U>ont. Drop down the <U>U</U>nderline box and choose Double, then click OK. To hide text, select it and choose 
<U>F</U>ormat, <U>F</U>ont, then select the H<U>i</U>dden box and click OK.</P>

<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>

<blockquote><p><img src="tip.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/tip.gif">

<P>There cannot be any spaces between the double-underlined text and the hidden text, or at the end of the hidden text. Word can give you some trouble about this, because the Smart Cut and Paste feature that works so nicely with words can insert extra 
spaces where you don't want them, or make it impossible to select only half a word. You can turn the feature off in Word by choosing <U>T</U>ools, <U>O</U>ptions, the Edit tab, and by deselecting the Automatic <U>W</U>ord Selection and Use <U>S</U>mart Cut 
and Paste check boxes.</P>

<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>

<P>Ready to test again? Save the files in Word, compile the Help project file, and execute ShowString; then click the What's This? button on the toolbar, and click in the main view. Your new &quot;How to Modify Text&quot; entry should display.</P>

<H3><B>Adjustments to the Contents</B></H3>

<P>This tiny little application is almost entirely documented now. You need to add the <U>T</U>ools menu and <U>U</U>nderstanding Centering to the Contents and check the index. The easiest way to tackle the Contents is with Help Workshop. Close all the 
Help-related files that are open in Developer Studio and Word, and bring up Help Workshop (it's in the Developer Studio folder). Open <font color="#008000">ShowString.cnt</font> by choosing <U>F</U>ile, <U>O</U>pen and working your way through the Open 
dialog box. This is the Contents file for ShowString.</P>

<P>In the first open book, click the View Menu item and then click the Add <U>B</U>elow button. (Alternatively, click the Window Menu item and then the Add <U>A</U>bove button.) The Edit Contents Tab Entry dialog box, shown in Figure 11.13, appears. Fill 
it in as shown; by leaving the last two entries blank, the default Help File and Window Type are used. Click OK.</P>

<A HREF="Mfigs13.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs13.gif"><b>Fig. 11.13</b></A>

<P><I>Add entries to the Contents tab with Help Workshop's Edit Contents Tab Entry dialog box.</I></P>

<P>Click the placeholder book, and click Add <U>A</U>bove again. When the Edit Contents Tab Entry dialog box appears, select the <U>H</U>eading radio button from the list across the top. As shown in Figure 11.14, you can change only the title here. Do not 
use Understanding Centering, since that is the title of the only topic under this heading. Click OK.</P>

<A HREF="Mfigs14.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs14.gif"><b>Fig. 11.14</b></A>

<P><I>Add headings to the Contents tab with Help Workshop's Edit Contents Tab Entry dialog box by selecting </I><I>the </I><I><U>H</U></I><I>eading radio button.</I></P>

<P>Add a topic below the new heading for Understanding Centering, whose ID is <font color="#008000">HID_CENTERING</font>, and remove the placeholder heading and topic. Save your changes, close Help Workshop, compile <font 
color="#008000">ShowString.hpj</font> in Developer Studio again, and test your Help. Choose <U>H</U>elp, <U>H</U>elp Topics, and you should see something like Figure 11.15.</P>

<A HREF="Mfigs15.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs15.gif"><b>Fig. 11.15</b></A>

<P><I>After saving the .cnt file and compiling the </I><I>.</I><I>hpj file, display the new table of contents by choosing </I><I><U>H</U></I><I>elp, </I><I><U>H</U></I><I>elp </I><I>Topics.</I></P>

<P>While you have the Help Topics dialog box open, click the Index tab. Figure 11.16 shows how the K footnotes you entered throughout this section have all been added to the index. If it looks a little sparse, you can always go to the .rtf files and add 
more keywords, remembering to separate them with semicolons.</P>

<A HREF="Mfigs16.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/ch11/Mfigs16.gif"><b>Fig. 11.16</b></A>

<P><I>The index has been built from the K footnotes in the </I><I>.rtf</I><I> files.</I></P>

<H3><B>From Here...</B></H3>

<P>This chapter has shown you all of the types of Help, the different ways the user invokes it, and the behind-the-scenes code that brings it up on the screen. You have also seen how to edit and write Help topics and Help contents files. Of course, there 
is much more to cover. If you have a large system to document, you need a book just on Help to give you a good perspective on designing and writing your Help content. Other parts of this book that might interest you include:</P>

<ul>

<li> <A HREF="index04.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index04.htm" target="text">Chapter 4</A>, &quot;Messages and Commands,&quot; gives more details on catching the messages generated when a user chooses a menu item or clicks a button.</P>

<li> <A HREF="index09.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index09.htm" target="text">Chapter 9</A>, &quot;Building a Complete Application: ShowString,&quot; introduces you to the sample application that was documented in this chapter.</P>

<li> <A HREF="index10.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index10.htm" target="text">Chapter 10</A>, &quot;Status Bars and Toolbars,&quot; shows you some other ways to help your user understand your application.</P>

<li> Part V, &quot;ActiveX Applications and ActiveX Controls,&quot; continues to expand ShowString by adding various kinds of ActiveX fu

⌨️ 快捷键说明

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