[Gambas-user] Method Paint.DrawText unclear

Benoît Minisini g4mba5 at gmail.com
Fri Oct 15 19:37:10 CEST 2021


Le 15/10/2021 à 19:31, Claus Dietrich a écrit :
> The method paint.DrawText is always puzzling me, because a variation of
> Width, Height and Alignment has no visual impact and the range of
> applicable Integer parameters for Alignment is undefined.
> 
> For example: The following commands provide 100% identical results:
> 
> Paint.DrawText("Hello", 0, 0, 0, 0)
> 
> Paint.DrawText("Hello", 0, 0, 100, 100)
> 
> Paint.DrawText("Hello", 0, 0, 0)
> 
> Paint.DrawText("Hello", 0, 0, 10)

Of course: as you don't specify any alignment, top left alignment is 
assumed (or top right if you use a rtl language), and so only the X and 
Y drawing coordinates have an impact of the text drawing position.

> 
> and I tried several integers as Alignment-parameter without any visible
> change. Which parameters are allowed and what do they do?

The Alignment argument is one of the Align class constants, and tells 
where the text is drawn inside the specified rectangle. I don't see what 
is utterly complicated here...

-- 
Benoît Minisini


More information about the User mailing list