[Gambas-user] PictureBox and Containers strange behaviour

Fabien Bodard gambas.fr at gmail.com
Sat Dec 1 08:42:40 CET 2018


Hi dear friend

This is the same with less work ;-)

Regards

Fabien Bodard

Le ven. 30 nov. 2018 à 16:30, Gianluigi <bagonergi at gmail.com> a écrit :

> 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
>>>
>>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>


-- 
Fabien Bodard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20181201/afcb9fd3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PaintImage-3-0.0.1.tar.gz
Type: application/gzip
Size: 20888 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20181201/afcb9fd3/attachment-0001.gz>


More information about the User mailing list