[Gambas-user] Output Printing

Benoit Minisini gambas at ...1...
Thu Dec 15 11:38:59 CET 2005


On Thursday 15 December 2005 08:26, Ignatius Syofian wrote:
> Hi all,
>
>
> I write printing output use draw command, the problem is: how can i format
> amount with #,###.## ?
>
> My sample code is :
>
> mglobal.rstemp=mglobal.db.exec("select * from ttransaction")
>
> for each mglobal.rstemp
>    draw.Text(Format(.rsTemp!fprice,"#,0##"),5,1+9*ypos)
> draw.Text(.rsTemp!fstockname,5+280,1+9*ypos)
>
> next
>
> but the output is like this
>
> Rice Cooker                            100.000
> Emergency lamp                       300
> Children Bed Set                  2.000.000
>
>
> why can't be like this (align right for amount)
>
> Rice Cooker                            100.000
> Emergency lamp                          300
> Children Bed Set                2.000.000
>
> Something wrong with my code
> or
> i can use another method ?
>
> like formating __.____.____ in text file, then printing to this text file ?

Draw.Text just write text left aligned from the specified position.

If you want right alignment, you can use that:

Draw.Text(Format(.rsTemp!fprice,"#,0##"), X, Y, W, H, Align.Right)

where X, Y, W, H are the dimension of a rectangle where the text will be drawn 
right aligned.

Be careful: the text is not clipped.

Regards,

-- 
Benoit Minisini





More information about the User mailing list