CGpGraphics.SetTextContrastmethod
Sets the contrast value of this **Graphics** object.
Syntax
FUNCTION SetTextContrast (BYVAL contrast AS UINT) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
contrast | The contrast value for antialiasing text. |
Return value
If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.
If the function fails, it returns one of the other elements of the GpStatus enumeration.
Description
Sets the contrast value of this Graphics object. The contrast value is used for antialiasing text.
Example
' ======================================================================================== ' This example sets and retrieves the text contrast level of a Graphics object. ' It draws text with a high contrast setting to demonstrate its effect. ' ======================================================================================== SUB Example_SetTextContrast (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi
' // Set text contrast to maximum (12) graphics.SetTextContrast(12)
' // Retrieve current contrast setting DIM contrast AS UINT = graphics.GetTextContrast
' // Create font and brush DIM font AS CGpFont = CGpFont("Arial", AfxGdipPointsToPixels(18, TRUE), FontStyleRegular) DIM brush AS CGpSolidBrush = ARGB_BLACK
' // Draw text with high contrast DIM layoutRect AS GpRectF = (0, 0, 0, 0) DIM text AS WSTRING * 128 = "Text contrast level: " & contrast graphics.DrawString(text, LEN(text), @font, @layoutRect, @brush)
END SUB ' ========================================================================================
Reference
- Include file
CGpGraphics.inc - Defined in AfxNova/CGpGraphics.inc:199
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class