[Gambas-user] PictureBox and Containers strange behaviour

Fabien Bodard gambas.fr at gmail.com
Sat Dec 1 18:56:37 CET 2018


you must not load images in one image... in fact you must load each image
in a image variable.

then you manage the layout during the drawing event.

a timer trigger  call the drawing area event when needed ... during the
move.



Le sam. 1 déc. 2018 à 18:28, Gianluigi <bagonergi at gmail.com> a écrit :

> Hi Fabien,
> the idea of loading images into one image was silly and I should have
> understood it right away.
> Too heavy.
> Aborted project.
>
> Regards
> Gianluigi
>
> Il giorno sab 1 dic 2018 alle ore 15:21 Fabien Bodard <gambas.fr at gmail.com>
> ha scritto:
>
>> Ok I seen the idea ...
>>
>> For the movement you can take a look in the FAbout of the ide code
>>
>> Le sam. 1 déc. 2018 à 14:05, Gianluigi <bagonergi at gmail.com> a écrit :
>>
>>> Hi Fabien,
>>> very interesting, excellent result and little work :-D
>>>
>>> My problem is to adapt a sequence of images of different format and type
>>> in a single film-like image (to be clear).
>>> I thought about doing so, this is just the first part of the code (now I
>>> use the mouse wheel just to try), I do not think I can adapt your code here.
>>>
>>> The idea (idiot) came to me from a question on our forum and so I would
>>> like to build an image viewer that shows a random image like a slot
>>> machine, now I start to study how to give it the movement (I do not know if
>>> two images series are enough).
>>> You can lose a lot of money by betting us over ;-D
>>>
>>> Regards
>>> Gianluigi
>>>
>>> Il giorno sab 1 dic 2018 alle ore 08:44 Fabien Bodard <
>>> gambas.fr at gmail.com> ha scritto:
>>>
>>>> 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
>>>>
>>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net
>>>> ]----
>>>>
>>>
>>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>>
>>
>>
>> --
>> Fabien Bodard
>>
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>
>
> ----[ 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/948dad0b/attachment.html>


More information about the User mailing list