[Gambas-user] Fitting a preview into a fixed area

Fabien Bodard gambas.fr at ...626...
Thu Nov 5 22:10:00 CET 2015


Maybe you can use a DocumentVuew for that... I will send you an example
tomorrow.
Le 5 nov. 2015 08:29, "Rolf-Werner Eilert" <eilert-sprachen at ...221...> a
écrit :

> A PictureBox:
>
>    PDF.Open(druck.TempVerz() &/ CStr(VorschauName) & ".pdf")
>    PDF.Zoom = 0.5
>    Vorschau = PDF[VorschauSeite].Image.Picture  'Where Vorschau is the
> PictureBox
>
> This runs fine e. g. when you set the PictureBox to AutoResize = True as
> it will automagically follow the size of the PDF. But then you need an
> appropriate space for the previews. When you want the preview area (the
> PictureBox) to have a fixed size, it is more difficult.
>
> I tried to use the Image and Stretch() first, then making it a Picture.
>
> But it was difficult for me to find the right values for ratio X and Y
> etc. Maybe just bad maths (typical me...), but when it was good for A4,
> an A3 became even smaller... ;)
>
> The simplest way turned out to be a square PictureBox, AutoResize =
> False, and a PDF size that makes A4 just reach out to the edges.
> Alignment = Center. This produces an A3 picture of the middle of the
> document which cuts the edges, but A3 is very rare anyway.
>
> So I found a workaround. And it has the advantage that it shows a very
> sharp picture (I presume pixel-on-pixel). With stretch() the picture is
> anti-aliased and becomes more fuzzy.
>
> Regards
> Rolf
>
>
>
> Am 04.11.2015 22:38, schrieb Fabien Bodard:
> > Well what control did you use for that ?
> >
> > 2015-11-04 13:06 GMT+01:00 Rolf-Werner Eilert <
> eilert-sprachen at ...221...>:
> >> I am showing a pdf preview. There are landscape and portrait pdfs, and
> >> some are A4, some are A3...
> >>
> >> Instead of following the size, I would like to fit them into a fixed,
> >> square preview area, i. e. the A3 ones would have to be shown smaller,
> >> but the aspect ratio must be kept of course, not stretched.
> >>
> >> Is there any automatic property, or how would you make it fit?
> >>
> >> Thanks for your ideas
> >>
> >> Rolf
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> _______________________________________________
> >> Gambas-user mailing list
> >> Gambas-user at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> >
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list