[Gambas-user] PictureBox

Bruce Steers bsteers4 at gmail.com
Thu Aug 26 17:10:12 CEST 2021


On Thu, 26 Aug 2021 at 15:56, bb <adamnt42 at gmail.com> wrote:

> On Thu, 2021-08-26 at 07:12 -0700, Jerry Betzer wrote:
> > Apologies in advance if I have selected the wrong address for this e-
> > mail.
> > I am a novice Gambas user and even more novice member of this user
> > list.
> > I am looking for help working with the PictureBox class.  I got off
> > to a pretty quick and easy start displaying my images (.jpg files)
> > but I am having difficulty fitting my pictures within the picture box
> > container in a proportional way.  Per the
> > gambaswiki.org/comp/gb.qt4/picturebox link it looked like I should
> > use the "Mode" attribute (specifically PictureBox1.Mode =
> > PictureBox.Contain).
> > When I run my program I get the following error:
> > unknown symbol "Mode" in class "PictureBox"
> >
> > My OS is:  Linux Mint 18 'sarah'
> > 'cinnamon 64 bit'
> >
> > cat /etc/os-release yields:
> > NAME = "ubuntu"
> > VERSION = "16.04 LTS (Xenia Xerus)"
> >
> > Gambas version:  3.8.4                   <----------------- TRUE?
> >
> > Code snippet:
> > Dim strMyString As String
> > strMyString = FileChooser1.Value
> > PictureBox1.Picture = Picture[strMyString]
> > PictureBox1.Mode = 3
> >
> > NOTE:  I have tried substituting PictureBox.Contain for the magic
> > number 3.
> >
> > Thanks in advance for any help.
> > -Jerry
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> You are using an incredibly old version of Gambas! (Typical Mint)
> I doubt whether PictureBox back then had much.
> Try and update to a more recent version.
>
> bruce
>

He's right that is pretty old.
Try this link...
https://launchpad.net/~gambas-team/+archive/ubuntu/gambas3

follow the instructions "Adding this PPA to your system" to upgrade to
gambas 3.16 stable.


But you will probably find your issue it the container/panel your picture
box is in.
It takes a little experimentation to make sure your picture box is not in a
panel that will stretch the image even if Contain is set.
try setting the parent panel Arrangement to Arrange.None and Expand = false.
If you are not sure if it is the panel shape set the panels background to a
temporary colour to highlight it's shape.

Best of luck
BruceS  (a different Bruce)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210826/5cfd0187/attachment.htm>


More information about the User mailing list