|
||||
TextOutCategory: TextHits: 7875 Rating: (2.62) votes 1522
Rate: 1-star 2-stars 3-stars 4-stars 5-stars
API Explanation
TextOut displays a line of text on a device. The relation of the text to the (x,y) pair passed to the function can be set using SetTextAlign. The text will be displayed using the device's currently selected font and text drawing color. The function returns 1 if successful, or 0 if an error occured. Parameter Information Declare Function TextOut Lib "gdi32.dll" Alias "TextOutA" _ (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, _ ByVal lpString As String, ByVal nCount As Long) As Long hdc The device context of the device to display the line of text on. x The x coordinate of the reference point to display the text at. y The y coordinate of the reference point to display the text at. lpString The string to display on the device. nCount The size in characters of lpString.
Code
' Display the text "Hello, world!" on window Form1 at (100,50).
' Center the text horizontally at that point and have it appear below the point. Dim retval As Long ' return value ' Set the reference point to be centered horizontally and on the top edge of the text: retval = SetTextAlign(Form1.hDC, TA_CENTER Or TA_TOP Or TA_NOUPDATECP) ' Display the text: retval = TextOut(Form1.hDC, 100, 50, "Hello, world!", 13) |