Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,573 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,886 people online right now. Registration is fast and FREE... Join Now!




streaching image in picturebox?

 
Reply to this topicStart new topic

streaching image in picturebox?, changing the size of a picture in a picture box

giuseppe105
15 May, 2008 - 06:03 PM
Post #1

New D.I.C Head
*

Joined: 15 May, 2008
Posts: 24


My Contributions
I am a beginner of visual basic I am learning this language in school and need to learn how to stretch the image in a picture box sorta like maximizing an image. I have found controls that stretch the picture box itself, this is a handy tool but it dosent help with that I need.

Question
How do I stretch image in picture box?

thank you ahead of time.
User is offlineProfile CardPM
+Quote Post

Zhalix
RE: Streaching Image In Picturebox?
15 May, 2008 - 06:28 PM
Post #2

D.I.C Head
**

Joined: 7 May, 2008
Posts: 218



Thanked: 9 times
My Contributions
If you just need an image to be stretched according to the size of the picturebox control, I think the imagebox control would be the better choice as it has a built-in stretch property. You'd probably have to do something pretty funky to get the picturebox stretching out.

Anyway, I'd use the imagebox instead.
User is offlineProfile CardPM
+Quote Post

giuseppe105
RE: Streaching Image In Picturebox?
15 May, 2008 - 06:39 PM
Post #3

New D.I.C Head
*

Joined: 15 May, 2008
Posts: 24


My Contributions
I'm using a BitBlt function and need the HDc control and auto redrawing I must use the picture box for this to work not only do I need to stretch the image in the picture box but I have to stretch the image that I am BitBlting on top of my image in my picture box.

tnx for posting
User is offlineProfile CardPM
+Quote Post

Zhalix
RE: Streaching Image In Picturebox?
15 May, 2008 - 07:39 PM
Post #4

D.I.C Head
**

Joined: 7 May, 2008
Posts: 218



Thanked: 9 times
My Contributions
Okay well, I just looked it up since I didn't know myself, but apparently this is a method to do this.

First have two picture boxes, one is hidden and the other is visible. Now you'll use the paintpicture method to paint onto the visible picture box using the hidden picture box as the source. Doing this allows you to specify to stretch the image out according to the size of the visible picture box.

This is the code I tested just now to get this effect:
CODE

Picture1.PaintPicture Picture2.Picture, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, vbSrcCopy

User is offlineProfile CardPM
+Quote Post

giuseppe105
RE: Streaching Image In Picturebox?
16 May, 2008 - 03:23 AM
Post #5

New D.I.C Head
*

Joined: 15 May, 2008
Posts: 24


My Contributions
Thank you for this code it dose what I need but I cant use it for how I bitblt my character on top of the picture.


10 mins later....

I wonder if I could copy my character to another invisible picture box that gets bigger which would stretch the character and then copy that and paste it onto the picture.


after school...

I think i failed at explaning myself again

I need a code that maked my game go full screen...

sorry for the comotion

This post has been edited by giuseppe105: 16 May, 2008 - 12:29 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 12:03AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month