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

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

?? ch17.htm

?? 24小時(shí)精通VC
?? HTM
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
<!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

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本在线播放一区二区三区| 日韩主播视频在线| 91麻豆精品国产自产在线| 国产主播一区二区| 一区二区国产盗摄色噜噜| 久久综合久久鬼色| 7777女厕盗摄久久久| 色综合av在线| 国产黄色精品网站| 奇米影视一区二区三区| 一区二区三区中文字幕在线观看| 精品少妇一区二区三区在线视频| 91久久奴性调教| 成人性生交大合| 久久99精品一区二区三区| 性做久久久久久免费观看欧美| 欧美激情一区二区三区不卡 | 久久蜜桃一区二区| 在线播放日韩导航| 色综合天天综合色综合av | 亚洲成人av中文| 综合电影一区二区三区 | 亚洲精品欧美在线| 国产精品无人区| www一区二区| 精品免费一区二区三区| 4438x亚洲最大成人网| 欧美三级乱人伦电影| 色域天天综合网| 97超碰欧美中文字幕| 国产成人精品在线看| 国产真实乱对白精彩久久| 琪琪一区二区三区| 日韩黄色免费网站| 石原莉奈在线亚洲二区| 亚洲成人精品在线观看| 亚洲国产aⅴ成人精品无吗| 亚洲一级不卡视频| 亚洲va欧美va国产va天堂影院| 亚洲欧美成人一区二区三区| 亚洲欧洲日产国码二区| 国产精品久久久久影视| 中文字幕在线不卡一区二区三区| 国产精品久久久久一区二区三区 | 99视频一区二区| av不卡在线播放| 91天堂素人约啪| 国产专区欧美精品| 国产乱子轮精品视频| 国产激情一区二区三区| 波多野结衣在线一区| 99久久国产综合精品麻豆| av男人天堂一区| 色天使色偷偷av一区二区| 一本色道久久加勒比精品| 欧美网站一区二区| 欧美一级久久久久久久大片| 精品国产亚洲在线| 亚洲国产精品成人综合| 一区二区三区小说| 亚洲午夜精品久久久久久久久| 石原莉奈一区二区三区在线观看| 久久www免费人成看片高清| 国产一区999| 99riav一区二区三区| 欧美性受xxxx黑人xyx性爽| 欧美一区二区三区免费大片| 久久综合久色欧美综合狠狠| 综合分类小说区另类春色亚洲小说欧美 | 欧美一区二区精美| 日韩一级完整毛片| 欧美岛国在线观看| 中文字幕一区二区不卡| 午夜电影一区二区三区| 国产精品888| 91久久精品日日躁夜夜躁欧美| 制服.丝袜.亚洲.中文.综合| 久久九九99视频| 一区二区久久久久久| 国产一区二区在线免费观看| 99久久精品久久久久久清纯| 91精品国产乱码| 中文字幕一区二区视频| 日本女优在线视频一区二区| 国产精品66部| 欧美日韩午夜在线| 国产色爱av资源综合区| 亚洲福利一区二区| 国产成人精品在线看| 67194成人在线观看| 国产精品热久久久久夜色精品三区| 亚洲午夜精品久久久久久久久| 国产一区二区精品在线观看| 欧美性感一类影片在线播放| 国产偷国产偷精品高清尤物| 亚洲午夜精品网| youjizz久久| 欧美tk—视频vk| 亚洲宅男天堂在线观看无病毒| 国产精品一二三| 日韩视频免费直播| 亚洲午夜精品在线| 99r国产精品| 欧美极品xxx| 激情五月婷婷综合网| 欧美日韩免费一区二区三区视频| 亚洲国产精品ⅴa在线观看| 麻豆精品视频在线观看免费| 欧美天堂亚洲电影院在线播放| 中文字幕一区二区三区不卡在线| 国产在线视频不卡二| 在线观看91精品国产麻豆| 亚洲综合久久av| 色拍拍在线精品视频8848| 日本一区二区三区在线不卡| 韩国一区二区在线观看| 欧美电影在哪看比较好| 亚洲成人动漫在线观看| 在线国产电影不卡| 亚洲免费av在线| 99久久免费精品| 一区在线观看视频| 国产91对白在线观看九色| 欧美成人三级在线| 奇米综合一区二区三区精品视频| 欧美日本视频在线| 亚洲成人免费在线观看| 欧美性生活大片视频| 亚洲在线视频网站| 欧美综合视频在线观看| 夜色激情一区二区| 欧美唯美清纯偷拍| 午夜激情一区二区三区| 91麻豆精品国产91久久久久久| 亚洲高清免费在线| 欧美久久一区二区| 蜜桃视频在线一区| 2023国产精品视频| 国产精品亚洲一区二区三区在线| 欧美精品一区二区三区四区| 韩国成人在线视频| 国产三级精品三级在线专区| 成人小视频免费观看| 国产精品美女久久久久久久| 成人黄色av网站在线| 国产精品的网站| 91免费在线视频观看| 夜夜嗨av一区二区三区中文字幕 | 欧美一区二区三区视频在线 | 一本到三区不卡视频| 亚洲卡通动漫在线| 欧美人体做爰大胆视频| 美国三级日本三级久久99 | 国产精品色眯眯| 99久久精品国产一区二区三区 | 日韩高清一区在线| 日韩情涩欧美日韩视频| 国产很黄免费观看久久| 国产精品成人一区二区艾草| 在线观看亚洲成人| 青青草原综合久久大伊人精品| 精品国产一区二区在线观看| 国产激情精品久久久第一区二区 | 欧美一区二区精品在线| 国产一区二区三区高清播放| 国产精品视频线看| 欧美日韩日本视频| 国产乱码精品一区二区三区忘忧草 | 亚洲精品日韩专区silk| 欧美三级电影一区| 久久国产精品99精品国产 | 欧美午夜免费电影| 精品亚洲国内自在自线福利| 中文字幕一区二区三区乱码在线 | 亚洲福利一区二区| 欧美精品一区在线观看| 91亚洲午夜精品久久久久久| 日韩av高清在线观看| 日本一二三四高清不卡| 欧美日韩高清在线| 成人午夜电影网站| 亚洲自拍都市欧美小说| 久久免费精品国产久精品久久久久 | 日本一区二区三区四区在线视频 | 亚洲视频在线观看三级| 91精品国产91热久久久做人人| 粉嫩av一区二区三区粉嫩| 一区二区三区免费网站| 精品sm在线观看| 在线观看免费视频综合| 国产成人欧美日韩在线电影| 亚洲成人久久影院| 国产精品国产三级国产| 日韩视频一区二区| 在线亚洲精品福利网址导航| 国产风韵犹存在线视精品| 日本中文字幕一区二区有限公司| 国产精品国产三级国产aⅴ原创 | 亚洲一卡二卡三卡四卡五卡| 久久精品欧美一区二区三区麻豆|