Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Is there a way to have VB resize a bmp? I only need like 32 x 32 pixels of the larger picture. Thanks for any ideas.

You can resize the image with VB, you need a graphics editor for that.
What you can do is put the image inside an Image box. Set the Stretch property to true and then adjust the size of the Image box to what you require - up or down.
Stuart

Okay, thanks, that almost works, it does resize the Image to 32 x 32 in VB, but when I use SavePicture to save it to Desktop, it still saves it the original large size. Do you know of anything else I could do?
Thanx again

Hi Jessica,
Here is a small porgamm I wrote quick based on ur Query. Hope thats what u wanted!What u need to do is :
1. Add two PictureBoxes.
2. Set for both to ScaleMode=vbPixelPrivate Sub cmdResize_Click()
Dim PicSize As Integer
PicSize = Val(InputBox("Enter ReSize Dimension for the Picture :", , 32))
If PicSize > 0 Then
Picture2.Move Picture2.Left, Picture2.Top, PicSize, PicSize
Picture2.PaintPicture Picture1.Image, 0, 0, PicSize, PicSize
End If
End SubPrivate Sub cmdSave_Click()
SavePicture Picture2.Image, "C:\Sam.bmp"
End SubWrite back for more help
Samuel Roshan

Many thanks, I'll try that tonight.
This is what I have now that isn't working, the new bmp is being saved the original size no matter where I try to change it!
Private Sub GetNewTile()
'get the new tile made from clipboard
'''''''''''''''''''''''''''''''''''''
On Error Resume Next
Dim NewVar As String
NewVar = Text3.TextIf TypeOf Screen.ActiveControl Is PictureBox Then
If Clipboard.GetFormat(vbCFBitmap) Then
'fill picturebox from clipboard
Picture1.Width = 32
Picture1.Height = 32
Picture1 = Clipboard.GetData()
Picture1.Width = 32
Picture1.Height = 32
' Save picture to desktop
If Which = 1 Then 'Win 95/98
SavePicture Picture1, "C:\Windows\Desktop\NewTile.bmp"
End If
If Which = 2 Then 'XP
SavePicture Picture1, NewVar
End If
End If
End If
End SubThanks again, I really appreciate it!

Yeah,
Changing The PictureBox's Dimension will not change the actual image that has been loaded into it. (i.e. It will not stretch the image)
No matter what Width and Height u change to, while using SavePicture function the Dimension of the picture loaded into the Picture box is used.(What a weird explanation!)
So what u have to do is change the size of the Picture loaded not the Picturebox.
Samuel Roshan

Thanks for your help :)
I have no idea how to do that, I guess I'll just Shell out to Paint and see if I can get to my bmp attributes with sendkeys somehow. Thanks again.

Update: It's working, I found something called the PictureClip Control that does the trick.
Thanks again for your time =)

PictureClip Control?
That is used for dividing a Picture into Multiple Rows and Columns!Mainly used for Animating!
How does it do the trick for u?
Samuel Roshan

![]() |
simple makefile question
|
Software submission servi...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |