Page 1 of 1
Form Background Picture - Scale or Tile
Posted: Sunday 3rd April 2022 5:35pm
by Askjerry
I have an image that is much larger than my form... I want to scale it so that it is always the size of the form no matter what.
I tried...
FMain.Picture.Width = FMain.Width
FMain.Picture.Height = FMain.Height
But that failed.... so how can I resize it? I didn't see anything in the properties like "Stretch" or "Tile"... unless I blatantly missed it.
I also have textures like graph paper that I use in my web pages... it would be nice to tile them as a form background.
I would be happy to just tell it to center the image... but I can't seem to do anything other than specify which image to use.
I would think it could be installed here...
Public Sub Form_Open()
' Update background image here... somehow...
End
How?
Re: Form Background Picture - Scale or Tile
Posted: Sunday 3rd April 2022 8:17pm
by vuott
Askjerry wrote: ↑Sunday 3rd April 2022 5:35pmBut that failed.... so how can I resize it? I didn't see anything in the properties like "Stretch"
Well, ...why not ?
Exemplum:
Public Sub Form_Open()
Dim pc As Picture
pc = Picture.Load("/path/of/image/file")
Me.Picture = pc.Stretch(Me.W, Me.H)
End
Re: Form Background Picture - Scale or Tile
Posted: Tuesday 12th April 2022 5:54am
by Askjerry
unknown symbol 'stretch' in class 'picture' in FMain:7.
Re: Form Background Picture - Scale or Tile
Posted: Tuesday 12th April 2022 11:22am
by vuott
Re: Form Background Picture - Scale or Tile
Posted: Thursday 14th April 2022 1:06am
by Askjerry
This says Version 3.12.2 so I will see if i can update it.
--> I went to the synaptic package manager... I did not see any versions beyond what i already have.
Thanks,
Jerry
Re: Form Background Picture - Scale or Tile
Posted: Thursday 14th April 2022 7:54am
by cogier
Hi Jerry, what distro are you using?
Re: Form Background Picture - Scale or Tile
Posted: Saturday 16th April 2022 8:51pm
by Askjerry
I'm not really sure... it is that latest package that was installed to this desktop from LinuxCNC as i was going to use this machine for CNC control.
I am developing my GAMBAS skills here... then I will migrate to the Raspberry Pi B3+ as I have several and will be building some teaching devices such as the Wind Tunnel project that I have been learning graphics for. I've created quite the GUI already.
My Raspberry Pi also appears to be running 3.12.2 so I will need to stick with that as my YouTube viewers will likely get the sme version and the software I create must work on all the platforms. In the Raspberry Pi I am also using piGPIO to control things such as motors, steppers, servos, etc.
Not sure how to find the distro... not like I can find an "ABOUT" button to click.
Jerry
Re: Form Background Picture - Scale or Tile
Posted: Sunday 17th April 2022 6:17pm
by cogier
On your main computer I think you are running a Debian distribution. If you open Terminal and type lsb_release -a I suspect you will be told you are running Debian buster. I may be wrong!
Debian buster has Gambas 3.12.2 in its repos.
I have just uploaded the latest recommended Raspbian OS (32 bit) on my pi 4, it is now based on Debian bullseye. Gambas 3.15.2 is in the repo.
Image.Stretch() is a valid command in 3.15.2
Not sure if that helps, but that's what I have discovered so far.
Re: Form Background Picture - Scale or Tile
Posted: Thursday 28th April 2022 10:30pm
by Askjerry
I found an easy work around, I just set an image box on the form, place the picture into it with "STRETCH" set to "TRUE".
Then, I set it to be the same size as the background form... for what I'm doing... it works a charm.
- Control Panel Demo.png (200.49 KiB) Viewed 3350 times
Thanks,
Jerry
Re: Form Background Picture - Scale or Tile
Posted: Tuesday 3rd May 2022 10:00am
by tincho
Hi Jerry,
Also you can stretch the image then conver it to picture, like:
Dim oImage As Image
oImage = Image.Load("/path/of/image/file")
Me.Picture = oImage.Stretch(Me.W, Me.H).Picture
Regards