ObjectDCL Banner

PictureBox_DrawText Method

Description

This method draws text on the control. If the text is going to be drawn outside the allowable width area the text is truncated. A bounding rectangle is used to define where the text is to be drawn.

Parameters

MyControlReference
Reference to the control in the form of MyProject_MyForm_MyControl.
ProjectFile
String identifying the project as it was passed in LoadProject.
DialogName
String identifying the dialog by name.
ControlName
String identifying the control by name.
UpperLeftX
Integer specifying the upper left X-axis coordinate.
UpperLeftY
Integer specifying the upper left Y-axis coordinate.
Width
Integer specifying the maximum width the text can span.
ForeColor
Color specifying the text color.
BackColor
Color specifying the background color. Pass 0 or -27 to draw the text with transparency.
Text
String specifying the text to draw.
Justification
String specifying the justification of the text.
  • "TL" (Top Left)
  • "TC" (Top Center)
  • "TR" (Top Right)
  • "BL" (Bottom Left)
  • "BC" (Bottom Center)
  • "BR" (Bottom Right)
Disabled
Boolean specifying whether to draw the text as disabled.

Return Values

Returns the following according to the situation:

  • T when successful.
  • Nil if the control is not found or is not visible.

AutoLISP Syntax

The recommended convention is passing the control identifier directly:

CopyCode imageCopy Code
(Odcl_PictureBox_DrawText 
		MyControlReference [as Reference]
		(list 
			(list 
				UpperLeftX [as Integer]
				UpperLeftY [as Integer]
				Width [as Integer]
				ForeColor [as Color]
				[Optional] BackColor [as Color]
				Text [as String]
				Justification [as String]
				[Optional] Disabled [as Boolean]) 
			(list 
				UpperLeftX [as Integer]
				UpperLeftY [as Integer]
				Width [as Integer]
				ForeColor [as Color]
				[Optional] BackColor [as Color]
				Text [as String]
				Justification [as String]
				[Optional] Disabled [as Boolean]) 
			...
		)
	)

An alternative convention is to identify the control by providing the project file, the dialog name and the control name:

CopyCode imageCopy Code
(Odcl_PictureBox_DrawText
		ProjectFile [as String]
		DialogName [as String]
		ControlName [as String]
		(list 
			(list 
				UpperLeftX [as Integer]
				UpperLeftY [as Integer]
				Width [as Integer]
				ForeColor [as Color]
				[Optional] BackColor [as Color]
				Text [as String]
				Justification [as String]
				[Optional] Disabled [as Boolean]) 
			(list 
				UpperLeftX [as Integer]
				UpperLeftY [as Integer]
				Width [as Integer]
				ForeColor [as Color]
				[Optional] BackColor [as Color]
				Text [as String]
				Justification [as String]
				[Optional] Disabled [as Boolean]) 
			...
		)
	)

Remarks

This function requires that the component is showing. Otherwise it has no effect.

The height parameter is automatically calculated and returned with the method. If the BackColor argument is not passed the PictureBox's BackColor property is use.

Please create lists as follows using the list keyword:

(list (list x y ...) (list x y ...) ...)
		

It seems that ObjectARX does not always handle lists created as follows:

'(x y ...) (x y ...) ...  
		

Applies For

PictureBox.

Example

CopyCode imageCopy Code
; Draw text
(Odcl_PictureBox_DrawText MyProject_MyForm_MyControl
		(list
			(list 50 50 500 -17 -27 "Some text" "TC" Nil)
			(list 50 75 500 -17 -27 "Some other text" "BC" T)
		)
	)

See Also

PictureBox_DrawArc, PictureBox_DrawCircle, PictureBox_DrawEdge, PictureBox_DrawFillRect, PictureBox_DrawFocusRect, PictureBox_DrawHatchRect, PictureBox_DrawLine, PictureBox_DrawPoint, PictureBox_DrawRect, PictureBox_DrawWrappedText