[Gambas-user] Two problems painting richtext

Tobias Boege taboege at ...626...
Wed Jul 17 14:40:33 CEST 2013


On Wed, 17 Jul 2013, Fabien Bodard wrote:
> In fact i fnt know what you want to achieve. So I've just trying to
> understand and then make it in a good way.
> 

What I want is to draw a box and richtext which is centered in that box. The
whole picture shall fade from black to transparency in a RadialGradient
(from the middle of the picture).

> Centering is different between draw and paint
> 
> Then you can't center a richtext vertically. This make sens when wrap is
> active.
> 

Not much sense. When wrapping is active, Paint should compute the number of
lines (based on the wrapping) to center the text vertically. Paint does
offer me the Align.Center possibility so I expect that it works that way.

> And you have give a bad zone for centering.
> 

Why? I want to have the text inside this box. Did I maybe misunderstand how
text is drawn with Paint? I give some text and a rectangle. The text will be
drawn inside the rectangle, wrapping the text if necessary, right?

> My way is not the only way. ... You can center by hand too.
> 

Basically, I don't want another way and especially no workaround which has
more lines than what I wrote. I'm asking why it doesn't work as expected -
or if I expect wrong things.

> Calculate the pos in _draw not in _arrange.

Why? The positions are dependent only on the DrawingAreas' dimensions and
these can only change when the Form changes dimensions. If this happens, the
Arrange event is raised. I can see no effective difference between doing it
in dwg1_Draw/dwg2_Draw or Form_Arrange, except that in Form_Arrange the code
is executed less than (or equal to) half of the times if would have been in
the Draw events.

Regards,
Tobi




More information about the User mailing list