网站首页  词典首页

请输入您要查询的函数:

 

术语 createcompatiblebitmap
释义 CreateCompatibleBitmap
语法:
HBITMAP CreateCompatibleBitmap(
__in HDC hdc,
__in int nWidth,
__in int nHeight
);
CreateCompatibleBitmap函数
该CreateCompatibleBitmap函数创建一个位图的是与指定的设备上下文关联的设备兼容。
参数
hdc [in]
一个句柄,设备上下文。
nWidth [in]
位图的宽度,以像素为单位。
nHeight [in]
位图高度,以像素为单位。
返回值
如果函数成功,返回值是一个句柄兼容位图(DDB)。
如果函数失败,返回值为NULL。
备注
至于由CreateCompatibleBitmap函数创建位图颜色格式相匹配的为HDC参数确定的设备颜色格式。此位图可以选择到任何内存设备上下文,是与原始设备兼容。
因为内存设备上下文允许彩色和单色位图,是由CreateCompatibleBitmap函数返回的位图格式不同时指定的设备上下文是一个内存设备上下文。然而,一个兼容位图,它是一个非内存设备上下文创建总是具有相同的颜色格式,并使用与指定设备上下文相同的调色板。
注意:当内存设备上下文创建,它最初有一个1 × 1单色位图到它选中。如果此内存设备上下文中使用CreateCompatibleBitmap,即创建位图是一个单色位图。要创建一个色位图,使用的是用于创建内存设备上下文,如以下代码所示HDC:
HDC memDC = CreateCompatibleDC(HDC)的;
HBITMAP memBM = CreateCompatibleBitmap(探知,nWidth,nHeight);
SelectObject(memDC,memBM);
如果应用程序设置nWidth或nHeight参数为零,CreateCompatibleBitmap返回句柄1 × 1像素,单色位图。
如果DIB的部分,是由CreateDIBSection函数创建一个位图,是到了为HDC参数确定的设备上下文选择CreateCompatibleBitmap创建一个DIB的部分。
当您不再需要的位图,调用DeleteObject函数将其删除。
实例
有关示例,请参见缩放图像。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWingdi.h(头文件:winuser.h)
LibraryGdi32.lib
DLLGdi32.dll
参见
位图概述
位图功能
CreateDIBSection
DeleteObject
SelectObject
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==CreateCompatibleBitmap Function
The CreateCompatibleBitmap function creates a bitmap compatible with the device that is associated with the specified device context.
Syntax
HBITMAP CreateCompatibleBitmap(
__in HDC hdc,
__in int nWidth,
__in int nHeight
);
Parameters
hdc [in]
A handle to a device context.
nWidth [in]
The bitmap width, in pixels.
nHeight [in]
The bitmap height, in pixels.
Return Value
If the function succeeds, the return value is a handle to the compatible bitmap (DDB).
If the function fails, the return value is NULL.
Remarks
The color format of the bitmap created by the CreateCompatibleBitmap function matches the color format of the device identified by the hdc parameter. This bitmap can be selected into any memory device context that is compatible with the original device.
Because memory device contexts allow both color and monochrome bitmaps, the format of the bitmap returned by the CreateCompatibleBitmap function differs when the specified device context is a memory device context. However, a compatible bitmap that was created for a nonmemory device context always possesses the same color format and uses the same color palette as the specified device context.
Note: When a memory device context is created, it initially has a 1-by-1 monochrome bitmap selected into it. If this memory device context is used in CreateCompatibleBitmap, the bitmap that is created is a monochrome bitmap. To create a color bitmap, use the HDC that was used to create the memory device context, as shown in the following code:

HDC memDC = CreateCompatibleDC ( hDC );
HBITMAP memBM = CreateCompatibleBitmap ( hDC, nWidth, nHeight );
SelectObject ( memDC, memBM );
If an application sets the nWidth or nHeight parameters to zero, CreateCompatibleBitmap returns the handle to a 1-by-1 pixel, monochrome bitmap.
If a DIB section, which is a bitmap created by the CreateDIBSection function, is selected into the device context identified by the hdc parameter, CreateCompatibleBitmap creates a DIB section.
When you no longer need the bitmap, call the DeleteObject function to delete it.
Examples
For an example, see Scaling an Image .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWingdi.h (include Windows.h)
LibraryGdi32.lib
DLLGdi32.dll
See Also
Bitmaps Overview
Bitmap Functions
CreateDIBSection
DeleteObject
SelectObject
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd183488(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:21:05