<div dir="ltr">Hi dear friend<div><br></div><div>This is the same with less work ;-)</div><div><br></div><div>Regards</div><div><br></div><div>Fabien Bodard</div></div><br><div class="gmail_quote"><div dir="ltr">Le ven. 30 nov. 2018 à 16:30, Gianluigi <<a href="mailto:bagonergi@gmail.com">bagonergi@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Finally it works<br>See attached file</div><div dir="ltr"><br></div><div>Reagards</div><div>Gianluigi<br></div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno ven 30 nov 2018 alle ore 15:39 Gianluigi <<a href="mailto:bagonergi@gmail.com" target="_blank">bagonergi@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">This is the correct code (?):<br><br>[code]Private Sub Scale(img As Image)<br><br>  Dim w, h As Integer<br><br>  w = img.W<br>  h = img.H<br>  If h > w Then<br>    $H = PictureBox1.H<br>    $W = (PictureBox1.H * w) \ h<br>    If $W > PictureBox1.W Then<br>      $W = PictureBox1.W<br>      $H = (PictureBox1.W * $H) \ $W<br>      $X = PictureBox1.X<br>      $Y = PictureBox1.Y + ((PictureBox1.H - $H) \ 2)<br>      Return<br>    Endif<br>    $Y = PictureBox1.Y<br>    $X = PictureBox1.X + ((PictureBox1.W - $W) \ 2)<br>  Else<br>    $W = PictureBox1.W<br>    $H = (PictureBox1.W * h) \ w<br>    If $H > PictureBox1.H Then<br>      $H = PictureBox1.H<br>      $W = (PictureBox1.H * $W) \ $H<br>      $Y = PictureBox1.Y<br>      $X = PictureBox1.X + ((PictureBox1.W - $W) \ 2)<br>      Return<br>    Endif<br>    $X = PictureBox1.X<br>    $Y = PictureBox1.Y + ((PictureBox1.H - $H) \ 2)<br>  Endif<br><br>End [/code]<br><br>Although I would love to be able to create a code capable of scaling images on the Form_Resize event<br>A task too burdensome for my tired brain.<br><br>Regards<br>Gianluigi<br></div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno ven 30 nov 2018 alle ore 13:10 Gianluigi <<a href="mailto:bagonergi@gmail.com" target="_blank">bagonergi@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">I need to paint an image in a new image and then show it in a picturebox.<br>The thing seems to work correctly only if the picturebox is the only component on the window.<br>If the hbox is present, the image is deformed (stretching) and the lower part of the image is positioned under the hbox.<br>Am I wrong?<br>I attach a project and two explanatory images (with magnifying glass).</div><div dir="ltr"><br></div><div>Regards</div><div>Gianluigi<br></div></div>
</blockquote></div>
</blockquote></div>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Fabien Bodard </div>