[Gambas-user] Method Paint.DrawText unclear

Fabien Bodard gambas.fr at gmail.com
Sun Oct 17 11:24:54 CEST 2021


you just have to imagin that the 4 values you give are a Rectangle where
you draw a text ... and then the Alignment value tell how to align text in
the rectangle.
The text rectangle is not clipped so the text is drawn outside the
rectangle if this one is too small to contain it. This allow to draw text
even if you not give the height/width values
By default the value of alignment is topleft.




Le ven. 15 oct. 2021 à 19:38, Benoît Minisini <g4mba5 at gmail.com> a écrit :

> 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
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>


-- 
Fabien Bodard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20211017/eb9560a5/attachment.htm>


More information about the User mailing list