Computing.Net > Forums > Programming > VB6 Manipulating bitmaps

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

VB6 Manipulating bitmaps

Reply to Message Icon

Name: JessicaQ
Date: October 4, 2006 at 20:58:08 Pacific
OS: XP
CPU/Ram: ??CPU 256mb
Product: ???Desktop model
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: October 4, 2006 at 22:22:03 Pacific
Reply:

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


0

Response Number 2
Name: JessicaQ
Date: October 5, 2006 at 00:08:22 Pacific
Reply:

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


0

Response Number 3
Name: SamRock
Date: October 5, 2006 at 06:50:09 Pacific
Reply:

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=vbPixel

Private 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 Sub

Private Sub cmdSave_Click()
SavePicture Picture2.Image, "C:\Sam.bmp"
End Sub

Write back for more help

Samuel Roshan


0

Response Number 4
Name: JessicaQ
Date: October 5, 2006 at 08:17:11 Pacific
Reply:

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.Text

If 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 Sub

Thanks again, I really appreciate it!


0

Response Number 5
Name: SamRock
Date: October 6, 2006 at 06:09:07 Pacific
Reply:

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


0

Related Posts

See More



Response Number 6
Name: JessicaQ
Date: October 6, 2006 at 11:08:44 Pacific
Reply:

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.


0

Response Number 7
Name: JessicaQ
Date: October 6, 2006 at 13:31:02 Pacific
Reply:

Update: It's working, I found something called the PictureClip Control that does the trick.

Thanks again for your time =)


0

Response Number 8
Name: SamRock
Date: October 10, 2006 at 03:00:39 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

simple makefile question Software submission servi...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB6 Manipulating bitmaps

Graphics manipulation in C++? www.computing.net/answers/programming/graphics-manipulation-in-c/13427.html

USB Events in VB6 www.computing.net/answers/programming/usb-events-in-vb6/14775.html

VB6 Problem, Please Help www.computing.net/answers/programming/vb6-problem-please-help/19850.html