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

📄 right11-1.htm

📁 Visual C++面向对象程序设计教程(配套习题资源)
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>第 11 章</title>
<base target="rbottom">
<style>
<!--
.右标题   { font-size: 10pt; color: #000080; text-indent: 0; margin: 0 }
.右内容   { font-size: 10pt; text-align: left; text-indent: 0; line-height: 100%; margin: 
               0 }
-->
</style>
</head>

<body>

<p style="line-height: 100%; margin-top: 0; margin-bottom: 0"> </p>
<p style="line-height: 100%; margin-top: 0; margin-bottom: 0"><span style="position: absolute; left: 4; top: -8"><img border="0" src="1.gif" width="63" height="70"></span></p>
<p style="line-height: 100%; margin-top: 0; margin-bottom: 0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p style="line-height: 100%; text-indent: 0; margin: 0" class="右标题" align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                                                  
&nbsp;&nbsp;&nbsp; <span style="background-color: #CCFF99">第 11 章</span><span style="background-color: #CCFF99">&nbsp;                                         
</span>&gt;<span style="background-color: #CCFF99"> 第 1 节 </span>&gt;<span style="background-color: #CCFF99">  
 11.1 图标</span></p>                  
<hr color="#008000" size="1">

<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font size="2"><font LANG="ZH-CN">一个应用程序允许有两个尺寸不一的图标来标识自己的身份:一种是大图标,它是</font>32<font LANG="ZH-CN">×</font>32<font LANG="ZH-CN">的位图;另一种是小图标,它是</font>16<font LANG="ZH-CN">×</font>16<font LANG="ZH-CN">的位图。在桌面或资源管理器窗口中,应用程序总是用大图标作为图形标识,而一旦应用程序启动后,其窗口的左上角和任务栏的程序按钮上就显示出其小图标。</font></font></p>
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"> </p>
<font SIZE="3">
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"></font><font size="2"><font LANG="ZH-CN">应用程序可以只定义大图标,就如上第</font>9<font LANG="ZH-CN">章的例</font>9-1<font LANG="ZH-CN">示范程序那样:把</font>WNDCLASS<font LANG="ZH-CN">结构的</font>hIcon<font LANG="ZH-CN">成员赋值为一个图标句柄,然后用</font>RegisterClass(   
)<font LANG="ZH-CN">函数注册窗口类。如果应用程序中还要使用小图标,那么必须采用扩展的窗口类</font>WNDCLASSEX<font LANG="ZH-CN">结构,并指定</font>hIconSm<font LANG="ZH-CN">成员为小图标的句柄,然后用</font>RegisterClassEx(   
)<font LANG="ZH-CN">函数进行注册。</font></font></p>
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"> </p>
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font size="2">1.   
<font LANG="ZH-CN">图标资源的创建和加载</font></font></p>
<p ALIGN="justify" style="line-height: 100%; margin-top: 10; margin-bottom: 0"><font LANG="ZH-CN" size="2">(1)   
图标资源的创建</font></p>
<font SIZE="3">
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"></font><font size="2"><font LANG="ZH-CN">图标资源的创建可以有两种方法:一是可以在</font>VC<font LANG="ZH-CN">集成开发环境中使用图标编辑器创建一个图标,此时会产生一个</font>.ico<font LANG="ZH-CN">文件,并且可以给此图标命名;第二种方法是在其他图形编辑器种创建图标文件(</font>.ico<font LANG="ZH-CN">文件),然后加载到资源文件中。</font></font></p>
<p ALIGN="justify" style="line-height: 100%; margin-top: 10; margin-bottom: 0"><font LANG="ZH-CN" size="2">(2)   
在应用程序中加载图标</font></p>
<font SIZE="3">
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"></font><font size="2"><font LANG="ZH-CN">应用程序通过调用函数</font>LoadIcon<font LANG="ZH-CN">进行图标资源的加载,此过程经常在定义窗口类时进行,函数</font>LoadIcon<font LANG="ZH-CN">的调用形式为:</font></font></p>
<blockquote>
  <blockquote>
    <p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font size="2" color="#008000">LoadIcon(hThisInst,   
    lpszIconName);</font></p>
  </blockquote>
</blockquote>
<font SIZE="3">
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"></font><font size="2"><font LANG="ZH-CN">其中,</font>hThisInst<font LANG="ZH-CN">为应用程序的当前实例句柄,</font>lpszIconName<font LANG="ZH-CN">可以有三种形式:</font></font></p>
<font SIZE="3">
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"></font><font LANG="ZH-CN" size="2">①   
图标文件名,必须用双引号括起来。</font></p>
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font size="2"><font LANG="ZH-CN">② 
图标ID,但是必须使用宏</font>MAKEINTRESOURCE<font LANG="ZH-CN">进行转换。</font></font></p>
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font LANG="ZH-CN" size="2">③   
系统提供的图标,系统提供的图标标识及其形状见表11-4。</font></p>
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"> </p>
<p ALIGN="JUSTIFY" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font lang="ZH-CN" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   
</font><font size="2"><font LANG="ZH-CN">表</font>11-4 Windows<font LANG="ZH-CN">系统提供的图标标识及其形状</font></font></p>  
<table border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse;
 border:none;mso-border-alt:solid windowtext .5pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt">
  <tr>
    <td width="135" valign="top" style="width:101.25pt;border-top:solid windowtext .75pt;
  border-left:none;border-bottom:solid windowtext .5pt;border-right:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt" align="center">
      <p class="MsoHeading8" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font size="2">标 
      识<span lang="EN-US"><o:p>
      </o:p>
      </span></font></p>
    </td>
    <td width="156" valign="top" style="width:117.15pt;border-top:solid windowtext .75pt;
  border-left:none;border-bottom:solid windowtext .5pt;border-right:double windowtext 1.5pt;
  mso-border-left-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt" align="center">
      <p class="MsoHeading8" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font size="2">形状<span lang="EN-US"><o:p>
      </o:p>
      </span></font></p>
    </td>
    <td width="158" valign="top" style="width:118.5pt;border-top:solid windowtext .75pt;
  border-left:none;border-bottom:solid windowtext .5pt;border-right:solid windowtext .5pt;
  mso-border-left-alt:double windowtext 1.5pt;padding:0cm 5.4pt 0cm 5.4pt" align="center">
      <p class="MsoHeading8" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font size="2">标 
      识<span lang="EN-US"><o:p>
      </o:p>
      </span></font></p>
    </td>
    <td width="132" valign="top" style="width:99.15pt;border-top:solid windowtext .75pt;
  border-left:none;border-bottom:solid windowtext .5pt;border-right:none;
  mso-border-left-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt" align="center">
      <p class="MsoHeading8" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><font size="2">形状<span lang="EN-US"><o:p>
      </o:p>
      </span></font></p>
    </td>
  </tr>
  <tr>
    <td width="135" valign="top" style="width:101.25pt;border-top:none;border-left:
  none;border-bottom:solid windowtext .5pt;border-right:solid windowtext .5pt;
  mso-border-top-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt">
      <p class="MsoNormal" style="line-height: 100%; margin-top: 0; margin-bottom: 0"><span lang="EN-US" style="mso-bidi-font-size: 10.0pt"><font size="2">IDI_APPLICATION<o:p>
      </o:p>  
      </font></span></p>

⌨️ 快捷键说明

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