导航:  GdiPlus Classes > GdiPlus Classes > CGpGraphics Class > Graphics Object >

DrawCachedBitmap

上一页返回章节概述下一页

描述

 

将存储在一个cachedbitmap物体图像.

 

C++ Syntax

 

Status DrawCachedBitmap(

[in]  CachedBitmap *cb,

[in]  INT x,

[in]  INT y

);

 

FreeBASIC 语法

 

FUNCTION DrawCachedBitmap ( _

   BYVAL pCachedBitmap AS CGpCachedBitmap PTR, _

   BYVAL x AS LONG, _

   BYVAL y AS LONG _

) AS GpStatus

 

参数

 

cb

 

[in]指向CachedBitmap包含要绘制的图像.

 

x

 

[in]整数,指定图像的左上角的x坐标.

 

y

 

[in]整数,指定图像的左上角的坐标.

 

返回值

 

如果该方法成功,则返回Ok,这是对Status枚举元素.

如果这个方法失败,它返回一个枚举的其他元素的Status.

 

备注

 

一个CachedBitmap对象是特定的显示屏幕优化格式存储图像.你不能画一个缓存位图到打印机或磁盘文件.

缓存位图不会比其他任何翻译转换工作.

当你建立一个CachedBitmap对象,你必须通过一个图形对象的构造函数的地址.如果图形对象关联的屏幕后缓存位图构造改变的比特深度,然后Graphics.DrawCachedBitmap方法会失败,你应该重建缓存位图.或者,您可以勾选显示更改通知消息,然后重建缓存的位图.

 

引用文件

 

CGpBitmap.inc (include CGdiPlus.inc)

 

示例

 

' ========================================================================================

' The following example creates a CachedBitmap object based on a Bitmap object and a

' Graphics object. The code calls the DrawCachedBitmap method of that Graphics object

' to display the cached bitmap.

' ========================================================================================

SUB Example_CachedBitmap (BYVAL hdc AS HDC)

 

  ' // Create a graphics object from the window device context

  DIM graphics AS CGpGraphics = hdc

  ' // Get the DPI scaling ratio

  DIM rxRatio AS SINGLE = graphics.GetDpiX / 96

 

  ' // Load the image

  DIM pBitmap AS CGpBitmap = "Climber.jpg"

 

  ' // Create a cached bitmap

  DIM cachedBitmap AS CGpCachedBitmap = CGpCachedBitmap(@pBitmap, @graphics)

 

  ' // Draw the cached bitmap

  graphics.DrawCachedBitmap(@cachedBitmap, 10, 10)

 

END SUB

' ========================================================================================