UID | title | description | helpviewer_keywords | old-location | tech.root | ms.assetid | ms.date | ms.keywords | req.header | req.include-header | req.target-type | req.target-min-winverclnt | req.target-min-winversvr | req.kmdf-ver | req.umdf-ver | req.ddi-compliance | req.unicode-ansi | req.idl | req.max-support | req.namespace | req.assembly | req.type-library | req.lib | req.dll | req.irql | targetos | req.typenames | req.redist | req.product | ms.custom | f1_keywords | dev_langs | topic_type | api_type | api_location | api_name | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NF:gdiplusgraphics.Graphics.DrawString(constWCHAR,INT,constFont,constPointF&,constBrush) |
Graphics::DrawString(const WCHAR,INT,const Font,const PointF &,const Brush) (gdiplusgraphics.h) |
The Graphics::DrawString method draws a string based on a font and an origin for the string. |
|
gdiplus\_gdiplus_CLASS_Graphics_DrawString_string_length_font_origin_brush_.htm |
gdiplus |
VS|gdicpp|~\gdiplus\gdiplusreference\classes\graphicsclass\graphicsmethods\graphicsdrawstringmethods\drawstring_75string_length_font_origin_brush.htm |
12/05/2018 |
DrawString, DrawString method [GDI+], DrawString method [GDI+],Graphics class, Graphics class [GDI+],DrawString method, Graphics.DrawString, Graphics.DrawString(const WCHAR*,INT,const Font*,const PointF&,const Brush*), Graphics.DrawString(const WCHAR,INT,const Font,const PointF &,const Brush), Graphics::DrawString, Graphics::DrawString(const WCHAR,INT,const Font,const PointF &,const Brush), _gdiplus_CLASS_Graphics_DrawString_string_length_font_origin_brush_, gdiplus._gdiplus_CLASS_Graphics_DrawString_string_length_font_origin_brush_ |
gdiplusgraphics.h |
Gdiplus.h |
Windows |
Windows XP, Windows 2000 Professional [desktop apps only] |
Windows 2000 Server [desktop apps only] |
Gdiplus.lib |
Gdiplus.dll |
Windows |
GDI+ 1.0 |
19H1 |
|
|
|
|
|
|
The Graphics::DrawString method draws a string based on a font and an origin for the string.
Type: const WCHAR*
Pointer to a wide-character string to be drawn.
Type: INT
Integer that specifies the number of characters in the string array. The length parameter can be set to –1 if the string is null terminated.
Type: const Font*
Pointer to a Font object that specifies the font attributes (the family name, the size, and the style of the font) to use.
Type: const PointF
Reference to a PointF object that specifies the starting point for the string.
Type: const Brush*
Pointer to a Brush object that is used to fill the string.
Type: Status
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Note that GDI+ does not support PostScript fonts or OpenType fonts which do not have TrueType outlines.
When you use the GDI+ API, you must not allow your application to download arbitrary fonts from untrusted sources. The operating system requires elevated privileges to assure that all installed fonts are trusted.
The following example draws a string at the specified origin.
VOID Example_DrawString2(HDC hdc)
{
Graphics graphics(hdc);
// Create a string.
WCHAR string[] = L"Sample Text";
// Initialize arguments.
Font myFont(L"Arial", 16);
PointF origin(0.0f, 0.0f);
SolidBrush blackBrush(Color(255, 0, 0, 0));
// Draw string.
graphics.DrawString(
string,
11,
&myFont,
origin,
&blackBrush);
}