[Gambas-user] Drawing

ron ronstk at ...239...
Mon Apr 24 17:19:17 CEST 2006


On Monday 24 April 2006 15:36, javier romero wrote:
> Ok, thanks, its works but the print is very small, i try scaling with this:
> 
>    draw.Begin(printer)
>      draw.drawing(p1,350,350, Printer.Width, Printer.Height)
>    draw.End
>    but dosent works the print is the same, little, i try then with
> 
>    draw.Begin(printer)
>      draw.drawing(p1,350,350, p1.Width, p1.Height)

read below

>    draw.End
> and the same, very little, in both dont change
> 
> How i scale?
> 
> sorry about my very bad english
> 
> Regards
> Javier
> ----------------------------------------
> > From: christian.faurebouvard at ...357...
> > To: gambas-user at lists.sourceforge.net
> > Subject: Re: [Gambas-user] Drawing
> > Date: Sat, 22 Apr 2006 17:50:15 -0400
> > 
> > El Viernes 21 Abril 2006 09:48, javier romero escribió:
> > > PUBLIC p1 AS Drawing
> > > PUBLIC pag AS DrawingArea
> > >
> > > PUBLIC SUB _new()
> > >     p1 = NEW Drawing
> > >     draw.Begin(p1)
> > >       draw.Text("Hello", 0, 0)
> > >     draw.End
> > >
> > > END
> > >

Remeber here the fontsize for the text.
It can be little. 8x14 *pixels*
Try to use draw.TextHeight and .TextWidth here to scale it up
draw.Text("Hello", 0, 0,430,720) can may be also used.

> > > PUBLIC SUB Form_Open()
> > >
> > > pag = NEW DrawingArea(sv1)
> > >    
> > >   pag.Cached = TRUE
> > >   pag.Clear
> > >   pag.BackColor = color.White
> > >   pag.Width = printer.Width
> > >   pag.Height = printer.Height

printer.Width and printer.Height
print and check those values.

Unknown if it is *inches*, *dots* or *pixels*
Normal paper sizes are given in inch or centimeter.
For the print head on old printers there are 72 dots/inch
8" paper has then 576 dots as width
Be carefull DPI is NOT pixels.
My screen is 1280 pixels
in cm it is 36 cm or 14 inch = 91pixels/inch
The given width here can be outside width or printable width
The left & right margin is unprintable and mostly given in cm or inchr
or in KDE as pixels where pixel is 1/72 inch
Printer.Size gives the papar size as code 'Letter' or 'A4'
Printer.Resolution the DPI the printer is currently set
Printer.Width and .Height together with real size from .Size will help yuo



> > >   pag.Border = 1
> > >   draw.Begin(pag)
> > >     draw.Drawing(p1, 0, 0)
> > >   draw.End
> > > ' This works OK
> > >   pag.Visible = TRUE
> > >  
> > > END
> > >
> > > PUBLIC SUB Button1_Click()
> > >    
> > >   draw.Begin(printer)
> > >     draw.drawing(p1,0,0, pag.Width, pag.Height)
> > >   draw.End
> > > ' This doesn't works
> > > END

using the "draw.drawing(p1,0,0, pag.Width, pag.Height)"
the value of 350 is around 4 inch (72 DPI/in)
Better use 24 or 35 as value (1/2 inch)

If the pag.width is the big number as i.e. 576 then substract 
2x24 or 2x35 from it.
See your printer documentation for the DPI value to verify.
Using KDE the KDEPrintmanager can help.


> > 
> > Hi Javier,
> > 
> > Some printers can't print in (0,0)
> > Try
> >  draw.drawing(p1, 350, 350)
> > 
> > it work, but very small, need to be scaled.
> > 
> > Regards,
> > Christian 
> > 

Success

Ron




More information about the User mailing list