亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ch17.htm

?? 24小時精通VC
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD>		<META NAME="GENERATOR" Content="Symantec Visual Page Mac 1.1">	<TITLE>Teach Yourself Visual C++&#174; 5 in 24 Hours -- Hour 17 -- Using Image Lists and Bitmaps</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><H1 ALIGN="CENTER"><IMG SRC="../button/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM"BORDER="0"><BR><FONT COLOR="#000077">Teach Yourself Visual C++&#174; 5 in 24 Hours</FONT></H1><CENTER><P><A HREF="../ch16/ch16.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch18/ch18.htm"><IMGSRC="../button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../button/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <HR></CENTER><H1 ALIGN="CENTER"><FONT COLOR="#000077">- Hour 17 -<BR>Using Image Lists and Bitmaps</FONT></H1><P>Image lists can be used to store collections of bitmaps, making them useful whenseveral bitmaps are needed, such as in tree view and list view controls. In thishour, you learn<UL>	<LI>How to create an image list<BR>	<BR>		<LI>The properties and methods that can be applied to an image list<BR>	<BR>		<LI>How to use an image list as a bitmap container<BR>	<BR>		<LI>The advanced drawing features offered by image lists</UL><P>Also, in this hour you will build a sample program that creates an image listand uses it as a storage location for bitmap images. This hour will build a foundationthat you will use later in Hour 18, &quot;List View Controls,&quot; and Hour 19,&quot;Tree Views.&quot;<H2><FONT COLOR="#000077"><B>What Is an Image List?</B></FONT></H2><P>An image list is similar to an array of bitmaps, just like a roll of film is anarray of images, as shown in Figure 17.1. Unlike rolls of film, an image list cangrow, if needed, as extra images are added to the list. Each bitmap stored in animage list is associated with an index, which can be used to retrieve a particularimage.</P><P><A NAME="01"></A><A HREF="01.htm"><B>Figure 17.1.</B></A> <BR><I>An image list is like a roll of bitmap images.</I><BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>Time Saver:</B></FONT><B> </B>Image lists can also be used	outside these new controls, and they provide an easy way to store a series of bitmaps,	because you must handle only a single image-list object instead of separate objects	for each bitmap. <HR></BLOCKQUOTE><P>If you want to display bitmaps in tree views or list views, you must use an imagelist. If your program needs to manage several different bitmapped images, a singleimage list is easier to use than a series of bitmaps. Accessing and displaying multipleimages from an image list is much easier than handling multiple <TT>CBitmap</TT>objects. Windows Explorer has a much richer user interface than the older File Managerused in Windows 3.1. Much of this richness is achieved through the use of image lists,which offer an easy way to store and manage bitmaps.</P><P>In addition, image lists offer two features that are difficult to duplicate withregular bitmaps:<UL>	<LI>Transparent images	<LI>Overlaid images</UL><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>transparent image</I>is an image that allows the background to be seen through part of the image, as ifpart of the bitmap were transparent.</P><P>A transparent image is difficult to achieve using a normal bitmap. In the simplestcases, about twice as many lines of code are required to draw a bitmap transparentlyas are required to draw it as an opaque image against a drawing surface. Using animage list, drawing a transparent bitmap is almost effortless, requiring little morethan parameters that are set correctly.</P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>An <I>overlaid image </I>iscreated by combining two images to form a single, combined image.</P><P>An overlaid image is useful when showing special attributes for items representedby images stored in an image list. For example, when a shared directory is shownin the Explorer, a server &quot;hand&quot; is superimposed over the directory's folder.This is an overlaid image.<H2><FONT COLOR="#000077"><B>How Is an Image List Used?</B></FONT></H2><P>As for almost everything else in Windows, there is an MFC class for image lists,too. The <TT>CImageList</TT> class is used to create, display, and otherwise manageimage lists in an MFC-based Windows program.</P><P>Image lists often are used to provide item images for the <TT>CListCtrl</TT> classthat is covered in Hour 18, and the <TT>CTreeCtrl</TT> class that is covered in Hour19. However, you can also use an image list as a collection of bitmaps, which youwill do in this chapter. Using image lists in this way helps show off the differentthings you can do with image lists before they are used with the common controls.</P><P>As an example of using image lists, create an SDI project named ImageList. Thisproject uses an image list to display a series of bitmaps in the program's clientarea.<H3><FONT COLOR="#000077"><B>Creating an Image List</B></FONT></H3><P>The first step in creating an image list is to create a series of bitmaps, eachof which is the same size. Although the images can be any size, the sample code inthis section assumes the bitmaps are 32 pixels on each side. The bitmaps used inthe example are shown in Figure 17.2.</P><P><A NAME="02"></A><A HREF="02.htm"><B>Figure 17.2.</B></A> <I><BR>The bitmaps used in the ImageList example are all the same size.</I></P><P>Create the three bitmaps, and name them as shown in Table 17.1.<H4><FONT COLOR="#000077">Table 17.1. Bitmaps used in the ImageList project.</FONT></H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><B>ID</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Description</B></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDB_CROSS</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">Cross mark</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDB_CHECK</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">Check mark</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDB_BANG</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">Exclamation point</TD>	</TR></TABLE></P><P>Storing a bitmap image in an image list consists of three steps:<DL>	<DD>1. Load the bitmap.<BR>	<BR>	2. Create a new image index in the image list that contains a copy of the bitmap.<BR>	<BR>	3. Delete the bitmap object.</DL><P>The bitmap object is deleted because the image list makes a copy of the bitmapand stores the image internally. As a rule of thumb, any time a Windows GDI objectis loaded, it should be deleted to prevent memory leaks. The preceding steps arehandled by <TT>AddBitmapToImageList</TT>, a new function added to the <TT>CImageListView</TT>class. Add the function provided in Listing 17.1 to the <TT>ImageListView.cpp</TT>source file.<H4><FONT COLOR="#000077">TYPE: Listing 17.1. The CImageListView::AddBitmapToImageListfunction.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>BOOL CImageListView::AddBitmapToImageList( UINT nResourceID )</TT><TT>{</TT><TT>    BOOL bReturn;</TT><TT>    CBitmap bmp;</TT><TT>    bReturn = bmp.LoadBitmap( nResourceID );</TT><TT>    if( bReturn != FALSE )</TT><TT>    {</TT><TT>        int nReturn = m_imageList.Add( &amp;bmp, RGB(255,255,255) );</TT><TT>        bmp.DeleteObject();</TT><TT>    }</TT><TT>    return bReturn;</TT></FONT></PRE><P><TT>}</TT> The <TT>AddBitmapToImageList</TT> function is used because three bitmapresources are added to the image list. Adding the bitmaps using a new member functionreduces the amount of code you must write and helps reduce the chance of errors,because every bitmap is loaded using the same function.</P><P>The <TT>CImageList::Add</TT> member function is used to add an image to the imagelist. The version of <TT>Add</TT> used in Listing 17.1 takes two parameters:<UL>	<LI>The address of the <TT>CBitmap</TT> image to be copied into the image list<BR>	<BR>		<LI>A <TT>COLORREF</TT> value that represents the background color of the bitmap</UL><BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>Time Saver:</B></FONT><B> </B>The background color is used	when drawing transparent images using masked bitmaps. If you aren't using a masked	image list, the <TT>COLORREF</TT> value is ignored. <HR></BLOCKQUOTE><P>After adding the member function to the <TT>ImageListView.cpp</TT> file, add thesource code from Listing 17.2 to the <TT>CImageListView</TT> class, found in thefile <TT>ImageListView.h</TT>. Add the source code in the class implementation section,which is marked by the <TT>// Implementation</TT> comment. After the comment, thereis a <TT>protected:</TT> label inserted by AppWizard for user- supplied variablesand functions.<H4><FONT COLOR="#000077">TYPE: Listing 17.2. Source code to be added to the CImageListViewclass.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>protected:</TT><TT>    BOOL        AddBitmapToImageList( UINT nResourceID );</TT></FONT></PRE><P><TT>CImageList m_imageList;</TT> The actual work of creating the image list isdone when the view is constructed. The image list can be built at any time; however,it is costly to create an image list in terms of computing power. Creating the imagelist in the constructor lets you build it once, rather than each time it is used.Add the source code from Listing 17.3 to the constructor for <TT>CImageViewList</TT>.<H4><FONT COLOR="#000077">TYPE: Listing 17.3. The CImageListView constructor.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>CImageListView::CImageListView()</TT><TT>{</TT><TT>    m_imageList.Create( 32, 32, TRUE, 3, 1 );</TT><TT>    AddBitmapToImageList( IDB_CROSS );</TT><TT>    AddBitmapToImageList( IDB_CHECK );</TT><TT>    AddBitmapToImageList( IDB_BANG );</TT></FONT></PRE><P><TT>}</TT> The image list is created using one of the <TT>CImageList::Create</TT>functions. This version of <TT>Create</TT> is useful when an image list is used asa bitmap collection; I use other versions of <TT>Create</TT> in the following chapters.This version of <TT>Create</TT> has five parameters:<UL>	<LI>The height of each bitmap; in this case, 32 pixels<BR>	<BR>		<LI>The width of each bitmap; in this case, 32 pixels<BR>	<BR>		<LI>Whether or not the image list is masked for transparency; in this case, <TT>TRUE</TT><BR>	<BR>		<LI>The number of bitmaps stored initially in the image list; in this case, three<BR>	<BR>		<LI>The &quot;grow-by,&quot; or the number of bitmaps added when the image list is	expanded; in this case, one</UL><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>masked image list</I>is an image list that contains two bitmaps for each image--the second bitmap is amask that is used when drawing transparent images. Parts of the image that are visibleare colored black in the mask, parts that are transparent are colored white in themask.<H3><FONT COLOR="#000077"><B>Displaying an Image List Using the <TT>CImageList::Draw</TT>Function</B></FONT></H3><P>Individual items stored in an image list can be drawn using the <TT>CImageList::Draw</TT>member function, as shown in Listing 17.4.<H4><FONT COLOR="#000077">TYPE: Listing 17.4. Using CImageList::Draw to display a

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲午夜久久久久久久久久久 | 一本到一区二区三区| 久久综合久久综合亚洲| 久久99久久久久久久久久久| 91精品国产色综合久久不卡电影 | 国产精品麻豆久久久| 成人午夜短视频| 国产精品久久久久久久第一福利 | 国内精品在线播放| 国产亚洲美州欧州综合国| 国产成人精品午夜视频免费| 国产精品国产精品国产专区不片| av不卡免费在线观看| 亚洲中国最大av网站| 欧美一区二区三区思思人| 九色|91porny| 国产精品久久网站| 欧美亚洲综合另类| 久久se这里有精品| 中文字幕制服丝袜一区二区三区 | 欧美日本在线一区| 美日韩黄色大片| 国产精品久久久爽爽爽麻豆色哟哟| 99久久精品免费| 日韩精品国产精品| 久久精品亚洲乱码伦伦中文| 在线亚洲欧美专区二区| 九色porny丨国产精品| 亚洲一区二区三区在线看| 免费日本视频一区| 国产精品久久网站| 欧美肥妇bbw| 国产成人h网站| 亚洲影视在线播放| 久久久www免费人成精品| 色婷婷综合久色| 国产精一品亚洲二区在线视频| 亚洲人精品午夜| 欧美xxxxxxxxx| 欧美成人在线直播| 99国产麻豆精品| 久久国产综合精品| 一区二区三区欧美亚洲| 337p日本欧洲亚洲大胆精品| 在线日韩一区二区| 国产成人av网站| 日韩激情在线观看| 亚洲综合色视频| 国产日产欧产精品推荐色| 91精品久久久久久久99蜜桃 | 丝袜亚洲另类欧美综合| 国产免费观看久久| 91精品国产综合久久久久久久久久| 99久久久免费精品国产一区二区| 麻豆视频观看网址久久| 亚洲一区二区偷拍精品| 国产精品久久久一区麻豆最新章节| 欧美va在线播放| 欧美挠脚心视频网站| 91理论电影在线观看| 风间由美一区二区av101| 久久精品国产精品亚洲红杏 | 91精品国产色综合久久不卡蜜臀 | 国产精品视频在线看| 精品国产免费视频| 日韩一区二区三区免费看| 欧美日韩另类一区| 在线观看欧美黄色| 91在线你懂得| 99国产麻豆精品| 91女厕偷拍女厕偷拍高清| 成人在线视频首页| 国产精品99久久久| 国模无码大尺度一区二区三区| 日韩二区在线观看| 日韩二区三区在线观看| 欧美aaa在线| 全国精品久久少妇| 青青草成人在线观看| 日本不卡在线视频| 久久国产婷婷国产香蕉| 国产一区二三区好的| 黄页网站大全一区二区| 国产一区二区在线看| 国产一区 二区 三区一级| 激情小说欧美图片| 国产精品一区二区视频| 懂色av一区二区在线播放| 丰满放荡岳乱妇91ww| www.在线成人| 在线视频国产一区| 欧美日韩免费观看一区三区| 欧美久久一区二区| 日韩一区二区高清| 国产午夜亚洲精品午夜鲁丝片| 亚洲国产成人自拍| 亚洲欧美一区二区视频| 一区二区三区免费观看| 全部av―极品视觉盛宴亚洲| 美女视频黄久久| 国产风韵犹存在线视精品| 成年人国产精品| 欧美性xxxxxx少妇| 成人免费一区二区三区在线观看| 成人欧美一区二区三区视频网页| 亚洲日本一区二区三区| 午夜免费久久看| 久久福利视频一区二区| 成人开心网精品视频| 91视频91自| 欧美一区二区三区爱爱| 国产无一区二区| 一区二区国产盗摄色噜噜| 奇米777欧美一区二区| 国产91清纯白嫩初高中在线观看| 日本乱人伦aⅴ精品| 日韩免费看网站| 中文字幕在线不卡一区| 视频精品一区二区| 成人一区二区视频| 欧美日韩免费视频| 中文av一区特黄| 午夜精品久久一牛影视| 国产福利视频一区二区三区| 欧美午夜精品免费| 国产情人综合久久777777| 亚欧色一区w666天堂| 床上的激情91.| 在线播放91灌醉迷j高跟美女 | 成人免费精品视频| 欧美精品123区| 国产精品久久久久久久久晋中 | 亚洲与欧洲av电影| 黄页网站大全一区二区| 欧美三级一区二区| 久久久电影一区二区三区| 亚洲一区二区三区国产| 国产aⅴ精品一区二区三区色成熟| 欧美午夜精品久久久| 中文字幕av一区二区三区免费看| 日韩1区2区日韩1区2区| 91老司机福利 在线| 国产欧美日本一区视频| 久久精品国产99国产精品| 欧美在线观看一区| ...av二区三区久久精品| 黄色日韩三级电影| 91精品国产综合久久精品图片| 日韩一区欧美小说| 国产成人精品亚洲777人妖| 欧美xxxx老人做受| 日本最新不卡在线| 欧美日韩一区高清| 亚洲免费av高清| 成人h动漫精品一区二| 国产拍揄自揄精品视频麻豆| 久久激情五月激情| 日韩欧美一区在线| 偷拍亚洲欧洲综合| 欧美视频一区在线| 一区二区三区精品视频在线| 成人av在线播放网站| 国产日韩欧美精品在线| 久久精品99国产国产精| 日韩欧美一级二级| 久久99最新地址| 欧美va亚洲va| 寂寞少妇一区二区三区| 日韩免费看的电影| 狠狠色丁香久久婷婷综合_中| 欧美一区二区三区视频在线 | 国产亚洲欧洲一区高清在线观看| 久99久精品视频免费观看| 日韩欧美国产系列| 另类小说欧美激情| 久久日韩粉嫩一区二区三区| 韩国在线一区二区| 国产亚洲一区二区在线观看| 国产精品一品二品| 国产精品人人做人人爽人人添| 国产成人av电影在线观看| 26uuu亚洲综合色欧美 | 视频一区国产视频| 欧美电影免费提供在线观看| 精品一区免费av| 久久久国产午夜精品| 99国产精品视频免费观看| 亚洲激情在线激情| 欧美日韩高清不卡| 久久成人av少妇免费| 国产亚洲制服色| 色中色一区二区| 日韩av在线发布| 久久精品亚洲乱码伦伦中文| 9i在线看片成人免费| 亚洲国产视频a| www国产成人| av动漫一区二区| 偷窥少妇高潮呻吟av久久免费| 精品少妇一区二区三区视频免付费 |