[Gambas-user] PictureBox and Containers strange behaviour
Gianluigi
bagonergi at gmail.com
Fri Nov 30 16:29:33 CET 2018
Finally it works
See attached file
Reagards
Gianluigi
Il giorno ven 30 nov 2018 alle ore 15:39 Gianluigi <bagonergi at gmail.com> ha
scritto:
> This is the correct code (?):
>
> [code]Private Sub Scale(img As Image)
>
> Dim w, h As Integer
>
> w = img.W
> h = img.H
> If h > w Then
> $H = PictureBox1.H
> $W = (PictureBox1.H * w) \ h
> If $W > PictureBox1.W Then
> $W = PictureBox1.W
> $H = (PictureBox1.W * $H) \ $W
> $X = PictureBox1.X
> $Y = PictureBox1.Y + ((PictureBox1.H - $H) \ 2)
> Return
> Endif
> $Y = PictureBox1.Y
> $X = PictureBox1.X + ((PictureBox1.W - $W) \ 2)
> Else
> $W = PictureBox1.W
> $H = (PictureBox1.W * h) \ w
> If $H > PictureBox1.H Then
> $H = PictureBox1.H
> $W = (PictureBox1.H * $W) \ $H
> $Y = PictureBox1.Y
> $X = PictureBox1.X + ((PictureBox1.W - $W) \ 2)
> Return
> Endif
> $X = PictureBox1.X
> $Y = PictureBox1.Y + ((PictureBox1.H - $H) \ 2)
> Endif
>
> End [/code]
>
> Although I would love to be able to create a code capable of scaling
> images on the Form_Resize event
> A task too burdensome for my tired brain.
>
> Regards
> Gianluigi
>
> Il giorno ven 30 nov 2018 alle ore 13:10 Gianluigi <bagonergi at gmail.com>
> ha scritto:
>
>> I need to paint an image in a new image and then show it in a picturebox.
>> The thing seems to work correctly only if the picturebox is the only
>> component on the window.
>> If the hbox is present, the image is deformed (stretching) and the lower
>> part of the image is positioned under the hbox.
>> Am I wrong?
>> I attach a project and two explanatory images (with magnifying glass).
>>
>> Regards
>> Gianluigi
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20181130/9d7b3543/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PaintImage-3-0.0.1.tar.gz
Type: application/gzip
Size: 20424 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20181130/9d7b3543/attachment-0001.gz>
More information about the User
mailing list