picturebox resize image before to insert into

User avatar
sal21
PlatinumLounger
Posts: 4169
Joined: 26 Apr 2010, 17:36

picturebox resize image before to insert into

Post by sal21 »

I have a jpg image hight 134 pixel and width 103 pixel.

possible, before, to set into the picturebox , to resize the jpg image in hight 115 pixel and width 103?

Tks.

User avatar
HansV
Administrator
Posts: 75751
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: picturebox resize image before to insert into

Post by HansV »

What is the size of the PictureBox control?
Regards,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4169
Joined: 26 Apr 2010, 17:36

Re: picturebox resize image before to insert into

Post by sal21 »

HansV wrote:
20 Nov 2022, 10:55
What is the size of the PictureBox control?
PictureBox SIZE is:
hight 115 pixel and width 103

User avatar
HansV
Administrator
Posts: 75751
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: picturebox resize image before to insert into

Post by HansV »

Can't you use an Image control and set its Stretch property to True?
Regards,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4169
Joined: 26 Apr 2010, 17:36

Re: picturebox resize image before to insert into

Post by sal21 »

HansV wrote:
20 Nov 2022, 11:25
Can't you use an Image control and set its Stretch property to True?
not really.
in effect after the image is resized, i need to save in the source dir, the new image with the new dimension, delete the old.

User avatar
HansV
Administrator
Posts: 75751
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: picturebox resize image before to insert into

Post by HansV »

Perhaps this reply helps.
Regards,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4169
Joined: 26 Apr 2010, 17:36

Re: picturebox resize image before to insert into

Post by sal21 »

HansV wrote:
20 Nov 2022, 13:21
Perhaps this reply helps.
TK.
I see tonight.

User avatar
sal21
PlatinumLounger
Posts: 4169
Joined: 26 Apr 2010, 17:36

Re: picturebox resize image before to insert into

Post by sal21 »

HansV wrote:
20 Nov 2022, 13:21
Perhaps this reply helps.
ops..

my piturebox is called PICCOM

how to modify in:

Code: Select all

 Option Explicit
    Private Sub Form_Load()
        Picture1.Picture = LoadPicture("C:\test\test.gif")
        
        Picture1.ScaleMode = 3
        Picture1.AutoRedraw = True
        Picture1.PaintPicture Picture1.Picture, _
        0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, _
        0, 0, Picture1.Picture.Width / 26.46, _
        Picture1.Picture.Height / 26.46
        
        Picture1.Picture = Picture1.Image
    End Sub

User avatar
SpeakEasy
3StarLounger
Posts: 319
Joined: 27 Jun 2021, 10:46

Re: picturebox resize image before to insert into

Post by SpeakEasy »

Simply replace the word Picture1 with the word PICCOM ...

User avatar
sal21
PlatinumLounger
Posts: 4169
Joined: 26 Apr 2010, 17:36

Re: picturebox resize image before to insert into

Post by sal21 »

SpeakEasy wrote:
28 Nov 2022, 18:46
Simply replace the word Picture1 with the word PICCOM ...
:clapping:
i'm stupid