📄 subject_21875.htm
字号:
<p>
序号:21875 发表者:小小阿胖 发表日期:2002-11-21 00:08:10
<br>主题:我想导入更多色彩的位图该怎么办?
<br>内容:请教各位高手,在VC的位图编辑器中,最多只编辑256色的位图,如果我要导入更多色彩的图片该怎么办呢?<BR>谢谢!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:Norton AntiVirus 回复日期:2002-11-21 08:34:27
<br>内容:使用LoadBitmap或者LoadImage
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:了了 回复日期:2002-11-21 08:51:06
<br>内容:必须编辑的话可以在其它软件(photoshop等)中编辑完再导入,然后尽管用就好了,虽然大于256色无法编辑,但不影响使用
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:小小阿胖 回复日期:2002-11-21 09:31:25
<br>内容:请问Green_Pig,那个LoadImage在哪里呢,我找不到?TKS!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:徐景周 回复日期:2002-11-21 10:00:30
<br>内容:可以用WINDOW自带的画图工具或photoshop等生成真彩位图,将它复制到你工程中的res目录下,在资源中点鼠标右键选“Import”导入你的位图,为它定义 一个ID,这样就可以直接在你的程序中使用它了,用LoadImage、LoadBitmap等来装入既可,可参看:<BR>http://www.vckbase.com/vckbase/vckbase12/vc/nonctrls/multimedia_22/1222001.htm
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Norton AntiVirus 回复日期:2002-11-21 10:49:35
<br>内容:在MSDN中是这样的:<BR>LoadImage<BR>The LoadImage function loads an icon, cursor, animated cursor, or bitmap.<BR><BR>HANDLE LoadImage(<BR> HINSTANCE hinst, // handle to instance<BR> LPCTSTR lpszName, // image to load<BR> UINT uType, // image type<BR> int cxDesired, // desired width<BR> int cyDesired, // desired height<BR> UINT fuLoad // load options<BR>);<BR>Parameters<BR>hinst <BR>[in] Handle to an instance of the module that contains the image to be loaded. To load an OEM image, set this parameter to zero. <BR>lpszName <BR>[in] Specifies the image to load. If the hinst parameter is non-NULL and the fuLoad parameter omits LR_LOADFROMFILE, lpszName specifies the image resource in the hinst module. If the image resource is to be loaded by name, the lpszName parameter is a pointer to a null-terminated string that contains the name of the image resource. If the image resource is to be loaded by ordinal, use the MAKEINTRESOURCE macro to convert the image ordinal into a form that can be passed to the LoadImage function. <BR>If the hinst parameter is NULL and the fuLoad parameter omits the LR_LOADFROMFILE value, the lpszName specifies the OEM image to load. The OEM image identifiers are defined in Winuser.h and have the following prefixes. Prefix Meaning <BR>OBM_ OEM bitmaps <BR>OIC_ OEM icons <BR>OCR_ OEM cursors <BR><BR><BR><BR>To pass these constants to the LoadImage function, use the MAKEINTRESOURCE macro. For example, to load the OCR_NORMAL cursor, pass MAKEINTRESOURCE(OCR_NORMAL) as the lpszName parameter and NULL as the hinst parameter. <BR><BR>If the fuLoad parameter includes the LR_LOADFROMFILE value, lpszName is the name of the file that contains the image. <BR><BR>uType <BR>[in] Specifies the type of image to be loaded. This parameter can be one of the following values. Value Meaning <BR>IMAGE_BITMAP Loads a bitmap. <BR>IMAGE_CURSOR Loads a cursor. <BR>IMAGE_ICON Loads an icon. <BR><BR><BR>cxDesired <BR>[in] Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width. <BR>cyDesired <BR>[in] Specifies the height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource height. <BR>fuLoad <BR>[in] This parameter can be one or more of the following values. Value Meaning <BR>LR_DEFAULTCOLOR The default flag; it does nothing. All it means is "not LR_MONOCHROME". <BR>LR_CREATEDIBSECTION When the uType parameter specifies IMAGE_BITMAP, causes the function to return a DIB section bitmap rather than a compatible bitmap. This flag is useful for loading a bitmap without mapping it to the colors of the display device. <BR>LR_DEFAULTSIZE Uses the width or height specified by the system metric values for cursors or icons, if the cxDesired or cyDesired values are set to zero. If this flag is not specified and cxDesired and cyDesired are set to zero, the function uses the actual resource size. If the resource contains multiple images, the function uses the size of the first image. <BR>LR_LOADFROMFILE Loads the image from the file specified by the lpszName parameter. If this flag is not specified, lpszName is the name of the resource. <BR>LR_LOADMAP3DCOLORS Searches the color table for the image and replaces the following shades of gray with the corresponding 3-D color: <BR> Color Replaced with <BR> Dk Gray, <BR>RGB(128,128,128) COLOR_3DSHADOW <BR> Gray, <BR>RGB(192,192,192) COLOR_3DFACE <BR> Lt Gray, <BR>RGB(223,223,223) COLOR_3DLIGHT <BR> Do not use this option if you are loading a bitmap with a color depth greater than 8bpp. <BR>LR_LOADTRANSPARENT Retrieves the color value of the first pixel in the image and replaces the corresponding entry in the color table with the default window color (COLOR_WINDOW). All pixels in the image that use that entry become the default window color. This value applies only to images that have corresponding color tables. <BR>Do not use this option if you are loading a bitmap with a color depth greater than 8bpp.<BR><BR>If fuLoad includes both the LR_LOADTRANSPARENT and LR_LOADMAP3DCOLORS values, LRLOADTRANSPARENT takes precedence. However, the color table entry is replaced with COLOR_3DFACE rather than COLOR_WINDOW.<BR> <BR>LR_MONOCHROME Loads the image in black and white. <BR>LR_SHARED Shares the image handle if the image is loaded multiple times. If LR_SHARED is not set, a second call to LoadImage for the same resource will load the image again and return a different handle. <BR>When you use this flag, the system will destroy the resource when it is no longer needed. <BR><BR>Do not use LR_SHARED for images that have non-standard sizes, that may change after loading, or that are loaded from a file.<BR><BR>When loading a system icon or cursor, you must use LR_SHARED or the function will fail to load the resource.<BR><BR>Windows 95/98/Me: The function finds the first image with the requested resource name in the cache, regardless of the size requested.<BR> <BR>LR_VGACOLOR Uses true VGA colors. <BR><BR><BR>Return Values<BR>If the function succeeds, the return value is the handle of the newly loaded image.<BR><BR>If the function fails, the return value is NULL. To get extended error information, call GetLastError.<BR><BR>Remarks<BR>When you are finished using a bitmap, cursor, or icon you loaded without specifying the LR_SHARED flag, you can release its associated memory by calling one of the functions in the following table. <BR><BR>Resource Release function <BR>Bitmap DeleteObject <BR>Cursor DestroyCursor <BR>Icon DestroyIcon <BR><BR><BR>The system automatically deletes these resources when the process that created them terminates, however, calling the appropriate function saves memory and decreases the size of the process's working set. <BR><BR>Windows 95/98/Me: LoadImageW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:小小阿胖 回复日期:2002-11-21 12:42:22
<br>内容: 谢谢各位,由其是Green_Pig老兄,还给我来了个E文测验,不过我作了弊,我用了金山快译,呵呵!还有,景周兄今天也大架光临我们菜鸟区,有失远迎,还望徐兄恕罪。<BR>咱们那个老百姓啊今儿个真高兴啦......<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:树爱兵 回复日期:2002-11-21 12:45:17
<br>内容:你搜搜看!网上好像有这方面的资料,我帮你找找1
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:小小阿胖 回复日期:2002-11-21 13:44:39
<br>内容:太谢谢你啦,不过我很菜,想要简单一点的例子<BR>树爱兵,我爱你
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:Norton AntiVirus 回复日期:2002-11-21 14:20:41
<br>内容:HBITMAP hBitmap = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_BMP), IMAGE_BITMAP, 0, 0, LR_VGACOLOR);<BR><BR><BR>像徐兄说得那样,把Bmp导入到工程中,然后分配一个ID,用上面的方法就可以了<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:小小阿胖 回复日期:2002-11-21 14:29:34
<br>内容:看来你不得到我这50分誓不罢休,好吧,给你,下次再放高点.不过你的回复要快点,不然别人抢了别怪我罗!!!<BR>呵呵!!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Norton AntiVirus 回复日期:2002-11-21 14:33:15
<br>内容:啊,本来就是俺先回复的阿!<BR><BR>:)
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -