导航:  GdiPlus Classes > GdiPlus Classes > CGpFont Class > Font Object >

GetLastStatus

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

描述

 

返回一个值,该值指示此对象最近的方法失败的性质.

一个详细的清单状态码看到<< a href ='gdip_status .htm'>状态</a>.

 

C++ Syntax

 

Status GetLastStatus();

 

FreeBASIC 语法

 

FUNCTION GetLastStatus () AS GpStatus

 

返回值

 

GetLastStatus方法返回的Status枚举元素.

如果没有对这个对象调用的方法都失败了因为GetLastStatus以前的电话,然后GetLastStatus返回OK.

如果至少有一个方法在图像对象调用失败,因为GetLastStatus以前的电话,然后GetLastStatus返回一个值,表示最近的故障性质.

 

引用文件

 

CGpFont.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example creates a Font object, checks to see that the call to create the

' object was successful, and, if it was, uses the Font object to draw text.

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

SUB Example_GetLastStatus (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

  DIM ryRatio AS SINGLE = graphics.GetDpiY / 96

  ' // Set the scale transform

  graphics.ScaleTransform(rxRatio, ryRatio)

 

  ' // Create a Font object.

  DIM font AS CGpFont = CGpFont("Arial", AfxPointsToPixelsX(16) / rxRatio)

 

   ' // Check the status of the last call.

  DIM status AS GpStatus = font.GetLastStatus

 

  ' // If the call to create myFont succeeded, use myFont to write text.

  IF status = Ok THEN

     DIM solidbrush AS CGpSolidBrush = GDIP_ARGB(255, 0, 0, 0)

     DIM wszText AS WSTRING * 260 = "The call succeeded"

     graphics.DrawString(@wszText, -1, @font, 0, 0, @solidbrush)

  END IF

 

END SUB

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