Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How To Strech Picture In Picturebox.


I'm making a program in which I have a picture in a picturebox. I want to stretch it (as we streatch an image box), according to the user input data. I, know that VB mainly offers this strech ability to Image Box, and I should use Image box for changing dimensions directly. But one problem in that, later in the program, I've to retrieve coordinates of black pixels from the picture in picturebox/imagebox according to its new dimensions. But if I take an image box, then I Can Not use GetPixel() for retrieving pixels, as an imageBox does not have hDc property. So, I'm intrested in using a PictureBox. Is there any way I can Achieve this? Thanks in advance.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
PictureBox Strech?
can u stretch an image in a picturebox?

Strech A Picture
I've been looking around and can't find a well-explained answer to my question. I'd like to be able to load a picture as an IPictureDisp type and the strech it. I've heard you can use StrechBlt to do this but the problem is it requres you to put in a hWnd and this is not a property of a standard image.

Strech Property In Picture Control
this might be a stupid question, but
How do you give a picture the size of a picturebox, if you load it in it. Just like the strech property of the image control?

Wilbert

Strech, Tile && Center Picture
Hi

I want to Strech, tile & center an picture on the form(Not MDI).

Help

Large Picture - Small PictureBox. How To Drag Picture Around Inside Picturebox?
I have a picturebox that is limited in size on my form.
I have pictures that are larger than the picturebox.
Is there a way that I can drag the picture around inside the picturebox to see different parts of it?

How Make Image Picture = Picture Drawed In Picturebox
hi i need some help here friends

how can i make image.picture = drawed picturebox

this is my example


Code:
Option Explicit

Const DI_MASK = &H1
Const DI_IMAGE = &H2
Const DI_NORMAL = DI_MASK Or DI_IMAGE
Private Declare Function ExtractAssociatedIcon Lib "shell32.dll" Alias "ExtractAssociatedIconA" (ByVal hInst As Long, ByVal lpIconPath As String, lpiIcon As Long) As Long
Private Declare Function DrawIconEx Lib "user32.dll" (ByVal hdc As Long, ByVal xLeft As Long, ByVal yTop As Long, ByVal hIcon As Long, ByVal cxWidth As Long, ByVal cyWidth As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal diFlags As Long) As Long
Private Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Long) As Long


Private Sub Command1_Click()
Dim hIconHandle As Long
Dim sPath As String
sPath = (App.Path + "" + "1.txt")
hIconHandle = ExtractAssociatedIcon(Me.hWnd, sPath, 0)
p.Cls
If hIconHandle Then
Dim div As Long
p.ScaleMode = vbPixels
div = Screen.TwipsPerPixelX
ScaleMode = p
DrawIconEx p.hdc, 0, 0, hIconHandle, p.Width / div, p.Height / div, 0, 0, DI_NORMAL
DestroyIcon hIconHandle

End If
Exit Sub

Image1.Picture = p.Picture

End Sub


it did not work for image
Image1.Picture = p.Picture


thanks alot

Getting PictureBox.Picture Filename From A Picturebox
How do you get the filename associated to a pictureboxes .picture property. when i do picturebox.picture after i've set it's picture using the loadPicture fuction all i get returned is a string of numbers.

Picture In Picturebox Moves To Picture Box On Its Left
Let's say you have a form with X number of picture boxes. How I can get the picture in each picture box to "go to" the picture box on its left?

NOTE: there will always be a picture box with no picture in it

Any help would be appreciated.
ex:
[nothing] [pic] [pic]

(User clicks command button):
 [pic] [pic] [nothing


ex using 4 picture boxes:
 [pic] [nothing] [pic] [pic]

(User clicks command1):
 [pic] [pic] [pic] [nothing] (the two last picture boxes moved over one to the left, so there would not be a picture box with nothing in it right in the middle of things

I hope this makes sense and someone can help me



Edited by - Marce22 on 7/28/2003 10:27:56 AM

Change The Picturebox Picture "how To Put The Picture Inside The Exe File"
Hi
I tried to change the picture box picture using this command
Pbox.Picture = LoadPicture(".mypic.jpg")
But the problem is that I need to include the jpg file in the same directoy, but I want only to work with the exe file without need to put extra files in the folder.

how can I insert this picture inside the exe file

Strech Blt
Why doesn't the following code work?


Code:
StretchBlt frmGame.picBackBuffer.hdc, 0, 0, frmGame.picBackBuffer.Width, frmGame.picBackBuffer.Height, frmPictures.picBG.hdc, 0, 0, frmPictures.picBG.Width, frmPictures.picBG.Height, vbSrcCopy

Getting More Then 1 Picture In A Picturebox
Hi,
I have one big picturebox, and 5 smaller ones.
the big picturebox doesn't contain any picture yet, why the 5 others contain a different sort of road (not small tiles like usual, but 700 x 500)
the main thing is that if I click on one of the 5 small picture boxes the big picturebox schould contain the image from the clicked small picture box
but when you click a second time on a small picturebox, the big picturebox should contain the first clicked image, and next to that the new clicked image
and you should be able to click as much as you want on the small imageboxes

Thx in Advance
Greetz
Davy

Picture From PictureBox.. Where R U?
Me again. I have a code that is one and a half year old. It has some pictures in PictureBoxes that are printed. Now I want to change the .bmp that is printed, but I cant find it anywhere... is there a way to find out where it is?
Can I get at least the path from where it was included? Tnks

If A Picturebox Has A Picture In It
Hello Everybody,

I want to make a if statement with a picturebox like:
if picturebox.picture = "" then msgbox "empty"
but the problem is, it gives a mismatch with the first part, I think it is picturebox.picture = "", cause I gessed the "", wat is the value that picturebox.picture gives if its empty???

Edited:

Sorry, I already found it, it gives a 0, so is there a way to delete this thread???

What Is Picturebox.Picture?
What is PictureBox.Picture?
Is it a packed DIB? or just Pixel data of an image...?
I'm facing few problems in turning a DIB Section into an object that can be assigned as Picturebox.Picture.

PictureBox.Picture
I have a Picture Box on my form, and im trying to figure out how to put in whatever image i want in that picturebox.

When the form loads, it will do something like this:

Picture1.Picture = "C:Picture1.jpg"

But i get a type mismatch error.

Im going to have an array of path's to pictures that i load from a file when the program starts, and when you click an item in a tree view, it will display the picture for that item. But i get type mismatch regardless of what i do.

Ive tried loading the pictures out of an imagelist, but that was a no go... Any ideas?

Picture In Picturebox..
I select a picture in a picture box from proprieties...but now i can't to delete it....
I know that is a stupid question...but i can't....how to do ?thanks...

How To Tell If Picture Is In Picturebox?
Whats the easiest way to determine if a picturebox contains a picture or if it is clear?

Thanks!

Which Picture Is In The Picturebox
Hello
I was trying to figure out which picture wasi n the icturebox. i look at the picture properties in the properties and it just says (Bitmap).

i double click on it and it just point me to the VB98 folder

Add Picture To Picturebox
Hi,

I want to do the following thing. There is a textbox and command button. Textbox is allows to have only A...Z, a...z, SPACE.

What I have is 26 images for A to Z and 1 for SPACE. When I type something and hit the command button I need to combine those images and show them to a picture box.

In reality I needed something more flexible which allows me to generate image as I type in textbox. So if I hit backspace then it will delete the last image from the combination.

Now there is no limit of how long the text will be so it's bit hard to achieve the flxible stuff so I am bound to have a Command button which will allow me to generate all the images together in a picture box. Now please don't ask why do I need this. I need it to generate a template.

I think I am making this clear enough to understand.

Cheers.

DC From Picture With Out PictureBox
I have seen this code before, but because of no search, i must post again. How do you load a picture into memory and recieve a DC for it. it think i know, but i'm not sure

Picture From Web In A Picturebox???
Can a picture form the internet be displayed in a picturebox if the URL,http://...pic.jpg, is known?

How Can I Know Picturebox Contains A Picture?
I am developing a paint application. In which i'm facing a problem. In this application some menus should be enabled only if picturebox conaints a picture so how can i know whether picturebox contains a picture or not?

Fit Picture In Picturebox
I have a picturebox with a fixed width and height of 2000 twips. The scalemode is set to pixel. Now I want to load an picture (bitmap), and it must fit the picturebox. I'm trying to do this by setting both scalewidth and scaleheight of the picturebox to either the height or width of the picture (whichever is the highest). however, the picture does not resize, it remains in it's original size.

This is the code I'm using. picSize is a hidden picturebox with autosize set to true, so I can get the width and height of the picture. When I run the code, both scalewidth and scaleheight of picBG (the picturebox that shows the picture) are set to 144, which is indeed the width of the bitmap I'm using.

Code:

picSize.Picture = LoadPicture(InputFile1)
picBG.Picture = LoadPicture(InputFile1)
If picSize.ScaleWidth > picSize.ScaleHeight Then
picBG.ScaleHeight = picSize.ScaleWidth
picBG.ScaleWidth = picSize.ScaleWidth
Else
picBG.ScaleWidth = picSize.ScaleHeight
picBG.ScaleHeight = picSize.ScaleHeight
End If


Anyone got any ideas on why this isn't working? Thanx

Strech Property
I used this property in the following context:

ElseIf Button.Key = "Stretch" Then
SlideImage.Stretch Not SlideImage.Stretch
ShowImage CurrentImage

When it ran this it said that the strech property was used incorrectly

Can someone help me plz

Strech Image
Does anyone know how I can strech a square image into different shapes? So if I have the a image that needs to be a diamond shape does anyone know how I can make the image fit to that shape. It has to be very quick too. thx

Icon Strech
I've made an ActiveX control which displays image. This image is loaded when a form is loaded. While testing my app on my machine (Win 98) everything was fine, but on other machine (Win 95) those image did not behave as well as I was expecting.

On Win 95 If I set Picture property with icon (16x16) it display icon but 32x32. What is wrong, doesn't Win 95 display small icons or what?

Maybe if I load it and then set strech property to TRUE, but isn't it read-only?

thx for help...

Fitting Picture Into Picturebox
Hello everybody,

I know there's a way to fit a picturebox around a image, so the picturebox takes the size of the picture, but I want to do the opposite, make the picture have the sizes of the picturebox, like resising it to the picturebox size, is this possible??? I if yes, how???

Size Of A Picture In A Picturebox
Hi

I'm working on some kind of a picture-explorer. The propose is that the picture should have the size of the imagebox and keep the aspectrate. It doesn't matter to me if it's a picturebox or imagebox, as long as it works.

example:

the image/picturebox is 300 * 200 pixels
the jpg is 500 * 300 pixels

the image/picturebox must stay the same size (300 * 200), but the jpg must be changed to 300 * 180

Is there a proporty where you can change the size of the jpg in the imagebox (so not the size of imagebox itself, but the size of the jpg)?

I know you can strech an imagebox, but if I do that the aspectrate isn't good anymore.

Thanks in advance!

Title Picture On PictureBox ??
I need a way to title a picture on picturebox.
Picture is 1x40 pix, and picturebox is 800x40 pix.
So when picture is titled, it should create horizontal gradient.

Plz any code for fast horizontal titling?

Center The Picture In A Picturebox
Hi!

Is there a way to center the picture in a picturebox?

Hope you can help me!

Loading A Picture To Picturebox
I'm dling an image from the internet and saving it to a tmp file then trying to load it to a picturebox.

Code:
ImCQɇ
~tdW3( nG].O{zP6p&X_]{Br'.!4ϻLc]KSpJln*~Mm^3s59:qҏÊjQԫ8Гր>_ZyF't_'<VToRfu ❀-':u<X*تGuFȵd_ab8j>6oESU􌽫X`lyXG5Fa9غÉ!M.
E6 $!q^T ;koϔ+#m~[.1pMϤgyG7A(g>L峢'Wtuu,Lﲼ{N¸]Rjܣ&<y*1,oq|gkNŸUk
d>Bzk;_Er
E[k3?t g:}%|%%Xf{5m7|e.[g4%cM:I*i^ĒN}L*fGq
^
+o`yU?d
pv O+$@
"Pҍ9q }I)a:~76_yoј"
QJ P9L`/'hBSr`R&S o9
 `761WtOI9sTB?؄zB
f
61*Ngl$ev
tRY.Q<zןO##Yժ[ܥBz$

I keep getting invalid picture can anyone tell me if that is a valid jpg picture?

Load A Picture Without Picturebox
I am making a level editor for a game. The user selects the bmp picture file from a list box. When the user moves the cursor and clicks on the form, I want the picture file to show at the position where they click. I can't use a picturebox because if the user clicks more than once it would have to create multiple pictureboxes. So I want a way to load a bitmap image onto the form at a specified position without the use of a picturebox. How can this be done?

Removing Picture From PictureBox
Well, I can load pictures like nothing else, but once a picture is loaded, how can you remove it? I've tried ... loadpicture (""), ... loadpicture Null and every other variation of blanks.

Picturebox Picture Question
Ok, here's my problem. I'm trying to take the drawn image in a picture box, and get it into an ImageList so it can be displayed in a listview. What I'm actually doing is making a color selector dialog, and I want the Listview to display shaded, colored blocks in the listview to represent the colors. To actually make those boxes, I change the background color of the PictureBox to the color I want and use the Line method of the PictureBox to shade the borders. But after that, I can't seem to get the resulting image from the PictureBox to the image list. If I use the Set statement like ImageList1.ListImages(1).Picture = Picrture1.Picture, it doesn't do anything. Any help would be appreciated.

Printing A PictureBox Picture
Hi, how I can print the picturebox picture ???


Thanks !!!!

Changing The Picture In A Picturebox
Hi again

I wonder how I can change the picture of a picture or picturebox control at runtime?
When I have the path (chosen by a common dialog) what should I do next?

Tia Legshot

Showing Picture In Picturebox
Hi all,I have a picture in a picturebox which is of bigger size then the form can handle..i.e more then 12180 twips....now i want to display whole picture in the picturebox which is in turn in a form......can i add scrollbars so that i can i can scroll the picture in picturebox..but i don't think that is possible.....is there a way around to display the picture.........I am using paintpicture method....i.e i want the graphics(more then one bitmap) to be painted at a particular position in the picturebox.

Stretch Picture In Picturebox
Is there any way that I can make the image in a picturebox so that it fills the whole thing? (Autosize won't work because the image is too small) Either making the image stretch or doing some sort of tile thing will work. Thanks

Jacob Sheehy
http://www.sheehy.ca

Multitasking - screwing up several things at once

Resizing Picturebox To Fit Picture
When I use Loadpicture("whatever.jpg") in a picturebox, how can I get the picture box to automatically resize to the width and height of whatever.jpg?

Thanks

Loading A Picture Into A Picturebox......
Ok, I have tried well over 30 examples of how to do this and none of them work. I'm using Visual basic 6.0.

I have a picturebox called picture1
I want to select a picture inside the program to load into the picturebox and have the picturebox display it

i have tried tons of methods using loadpicture
i have tried every code sniplet i have found on the net
nothing works.

Any idea how to do this?

Picture Of Form To Picturebox
Can anyone help my with sending a picture of a form to a picturebox ?

I'll just need a image of it, so i an show it resize it and send it to the printer.

please help...

isn't it something with formname.paintpicture ?

but how does it work , iv'e tried but it didn't work ...

Using A Different Picture For MouseOver In A PictureBox
I have a PictureBox [picBack] with a BMP in the Picture property. Now, I want to be able to make that picture different when the mouse is over the picturebox. I don't see a MouseOver event, and I've done a brief search of the forums for one - no luck. Does anybody know how to do this? Thanks in advance for any and all help.

Until next time, take care and God Bless!
-Tony

Find A Picture In A Picturebox!
Ok, heres my problem:

Say I have a picturebox 500x500 pixels with a big picture in it.. And then I have another picture in another picture box 100x20 pixels... And I want to find the minipicture in the big picture.. Like search for it you know?

But I want it to only search for white pixels, and forget any other color!

Like find a picture in a picture..
And it returns true or false of course


Thanks if you can help!

Packed DIB -&gt; Picturebox.Picture
How to make a Picturebox picture from a packed DIB?

Copy Picture From One Picturebox To Another
OK, I have two Picturebox Controls. One has a picture in it (actually the picture is the results of my program drawing it, not a loaded bitmap).

The other picturebox is empty and it is smaller than the first picturebox.

I need to copy the picture or image from the first picturebox to the second picturebox but at a pre-determined X and Y.

Now my thinking is that it doesn't matter if the dest. picturebox is smaller than the source picturebox because I think it will copy the picture to the X and Y and not all of the source picture will show in the dest. picturebox but I think that if later I resize the dest. picturebox and make it bigger then the rest of the picture will become visible. But it doesn't matter if that doesn't happen I just need to know how to copy from one to the other at a pre-determined X and Y.

Setting Picturebox Picture
Hello all, I have a form with 4 picture boxes on it (Picture1, Picture2, Picture3, Picture4). How can I do the following:

On form_load, it goes into "C:music" and gets all of the folders in there...each folder has 'album.jpg' in it...I want it to load the first 4 albums into the pictureboxes. When I hit a Next button, it retreives the next 4, and places them in the picturebox...and so on and so on. How can I do this?

Tile Picture In Picturebox
Ive got a form with 2 frames on it, inside the left frame is a button array. On the right side is the questions in the program. When it starts it loads the questions from a file and displays the first question, its multiple choice. You select your answer and click ok, then it displays the 2nd question, and so on... You cant view future questions, but you can view and go back to any of the previous questions. There's a scroll bar scrolling the question and button frames within a bigger frame since im using a tabstrip.

Here's the issue, im trying to make it look all graphical, but i because the size of the frames the questions are in keep getting bigger, and there's no set size, im going to make a tileable background picture for both of the frames. But i dont know how to tile it.

I figured it might be easiest to put a picturebox in the frame, and anytime the frame size is changed it will resize the picturebox to the size of the frame, and i can load a picture in the picturebox and tile it.. But there's no tile option.. So i have to do it manually.

Anybody know how to do this?

Center Picture In Picturebox
Without using another picturebox, is there a way to center a picture inside a picturebox both horizontally and vertically?

Its a tiny issue in my program.. It would look alot better if i could do this, but i'd really rather not use a 2nd picturebox for each picture... I already know how to do it that way, just put the picture in the picturebox thats inside antoher picturebox, autosize it, then center the inner picture box inside the other, thats easy but the problem is that creates ALOT of work for me becuase of the way i have everything setup for printing.

If anybody knows if this is possible please lemme know!

Picture Not Displaying In Picturebox
This is killing me. Hoping that someone can help.Why is test.jpg not appearing in picture2?I get a runtime error when it tries to resize it.
Code works fine on a SDI interface.

Edit: Project modified to remove unnecessary code and added option explicit to all pages.

Copyright 2005-08 www.BigResource.com, All rights reserved