Hi Matti, You are right, but only if the photo is as large as the PictureBox or smaller. If it's larger, the photo's center will be shown, but at its original size, i. e. you will see part of the photo only.
After some fiddling, my father and I found a formular based on the size of the PictureBox (133 x 133) in my program. The PictureBox is named Foto, b means Width: DIM b, h AS Integer DIM xy AS Float DIM bild AS NEW Image bild = Image.Load(ldsv.dateipfadModelle() &/ basisDaten[0]) b = bild.Width h = bild.Height IF b > h AND b > 133 THEN xy = b / h h = h - ((b - 133) / xy) b = 133 ELSE IF h > b AND h > 133 THEN xy = h / b b = b - ((h - 133) / xy) h = 133 END IF Foto.Picture = bild.Picture Foto.Width = b Foto.Height = h Foto.Stretch = TRUE This way I tried it with 200 x 300 px photos in landscape and portrait, everyting running perfectly. What do you think? Rolf Am 15.03.2012 20:18, schrieb Matti: > Hi Rolf, > > Square PictureBox is correct. > Stretched has to be set to false. > Then just set Alignment to Center (in code: 3). > That's all. > > Matti > > Am 15.03.2012 10:14, schrieb Rolf-Werner Eilert: >> Hi folks, this is in Gambas2: >> >> On a form, I have a PictureBox which shall show photos in landscape and >> portrait. So I drew a square PictureBox. >> >> I expected that if the photo has not the same aspect ratio, it will be >> shown with bars of the background color, but when I say Stretched = >> True, the picture will be shown as fitted into the complete PictureBox. >> >> Is there any way to avoid this? Or is the only way to achieve an aspect >> ratio correct display, changing the PictureBox's Height and Width? >> >> Thanks for your answers. >> >> Rolf > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user