How Can I Load A Picture In A Picture Box To A Image's Picture
hi all! i have a picture box, in that picture box, there is a picture asume it as "pic1.bmp".. now i have made some changes in that picture.
Now i want to load a picture to a image( my form consists of a picture box and a image also).
like image1.picture=loadPicture(picture1.picture) ...
but i know that this statement is invalid....
how can i do it? actually.. yesterday i learned how to make changes on a picture and how to save a picture as .bmp..
so i can do one thing like save the modified picture box as .bmp and can load that .bmp into my image....
suppose if i do.. like this.. i need to change my entire code... since in my real application my images are controll array.. and its better to load the pictures from picturebox control array to this image controll array....
is there any posibility of doing like this.... if so kindly help me...
Thanks in advance.. regards: raghunadhs.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Load Picture At Run Tme In Picture Property Of StatusBar_Panel(1).Picture
I am trying to load an picture at run time at every Form's
StatusBarPanelPicture property but it seems that it doesn't show up .
Any ideas?
Thanks Panayiotis.
Public Sub main_logo_load()
On Error GoTo Load_Other
'Connections.Arr(1) array field holds the driveletter to which I have
the folder located .
Set Forms.Controls("staMain").Panels.Item(1).Picture = _
Connections.Arr(1) & ":CharterManagerImagesLogo-Small.gif"
'Forms.Controls.staMain.Panels.Item(1).Picture = LoadResPicture(1, 1)
Load_Other:
If Err.Number = 53 Then
Set Forms.Controls("staMain").Panels.Item(1).Picture =
LoadResPicture(10, vbResBitmap)
End If
End Sub
How Do You Print Screen Then Load That Picture Into The Form.picture Property?
This is something that I've been trying to do for ages, but I've never had any success- Does anyone know how to print screen with code and then load that picture onto a form? I've got most of my program written, but I can't figure how to load a picture from the clipboard onto my form. I have a SendKeys to send a print screen keypress, but I don't know if it works properly. Can anyone help me?
Thanks
Now, don't get me wrong, 'cause baseball's a great sport.
It teaches little children simple eye-hand coordination with little effort or exhaustion.
-byufan
Return The Path Of A Picture Load In A Picture Box
I have an array of picture boxes. When I right click on one of them, I want to return the path of the picture loaded in it. All I seem to be able to get is a long value for the picture. Is there some way to return the path?
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
Displaying Picture In Image / Picture Control
Dear All,
I have placed an image control on my form. A bitmap picture(picture name is shapes) is placed at my C drive. There is also a command button on the form.
I want that when I click the button, the picture should be displayed in the image control.
When I use the following code in the click event of command button it gives me type mismatch error.
Me.Image1.Picture = "C:shapes"
If I try to do so using Picture control, same error comes.
Plz help and guide.
Regards,
Rotate A Picture In An Image Control, Not A Picture Box!!!!!!!!!!!!!!
I posted a question yesterday (all my troubles seem so far away...) about a picture rotation. All that I find concern a Picture Box control.
It is impossible to get the same thing with an Image control???
I need the stretch property , so I can't use Picture Box.
Please Help me....
Load Picture Using Image List
i am doing a chatting application ...
i have a userlist list out in a list box
..
now i want to load a picture icon beside the user name
can anyone give me the code to load picture into an array using imagelist.......
and show up beside every username that i load in an array...
thanks
Load A Picture From An Image List To A Picturebox.
Read the subject.
How do I load a picture from an image list to a picturebox?
I did something like this to add a picture to the image list.
VB Code:
imgList.ListImages.Add , "0_01", LoadPicture(App.Path & " _01.bmp")
Thanks in advance.
Picture Box Picture To Image Control
I am blting part of one picture box into another picture box, but I really want this to be in an image control, so i say image1.picture = picture1.picture but it doesn't work, nothing goes into the image control. Is there a different way to do this?
Image Or Picture Box Picture Resize
When ever you load a picture into a picture box with the stretch property to true, it will of course expand to the size of the image. Lets say I have an image 500x300pixels. I want it to fit into my image or picture box that is 250x150. Kind of like how thumb nails work. Or on windows explorer when you single click a file, it will show a smalled size of the actual image. There might be a property for this, ive just been looking at VB for so long working on a project that if its there, I dont see it. Thanks.
Making A Picture Fit The Picture Box Instead Of The Box Fitting The Picture.
Hello,
I was wondering if anyone could tell me how to make a picture fit the picture box instead of the box fitting the picture. So I would want the picture to get smaller like the image preview on windows xp, when you click once on a pic and it shows the details and a small form preview of the pic yet not disformed (i.e NOT STRECHED)
Can someone show me how to do this?
Thank you and have a great day!
Stilekid007
Scale A Picture To Fit In A Picture Box And Maintain Height To Width Ratio?
I am writing a program where I would like to allow the user to load pictures into a data record, and these would be displayable by a picture box on the form showing the record. The problem I have is that if the picture is too big, it is clipped, and if I use an image with the stretch method, I risk having the picture distorted as the Height to Width ratio could then be altered by the code. I'd like a way to scale a picture to fit in the picture box, while maintaining the Height to Width ratio. Any suggestions?
Pegasus37
Code To Place A User Selected Picture As The Background Picture
This is an odd request. My company (in its infinite wisdom) has decided to automatically place the company logo as the background picture at network logon.
I'd like to write a little VB program that I could put in the Startup folder that would replace that with my selected picture automatically.
Any ideas on how to access the Windows Background property? Thanks.
Nate
List Box Selected/picture Box/radio Buttons To Flip Picture
If I have a list of say 50 text items dumped as an array in the list box, and clicking on 1 item brings up a picture in a picture box, and there are two radio buttons next to the picture, one default with the list selection text(no change), but the other one, when clicked, brings up a different picture; in other words, once the selection is made in the list box, is it possible to flip between images with the radio buttons.
I would have done it with Select Case, but that means having the full list of items in the list box in the code of the radio button. Is there a better way?
Comparing Picture1.Picture To Picture2.Picture Not Working?
I have two picture boxes on a form. Picture1 & Picture2. I want to compare if the pictures are the same.
I am using:
IF Picture1.Picture <> Picture2.Picture THEN
' STuff here
END IF
It doesn't seem to work. It always thinks they are different even though they are not (they are loaded from the same source file).
There must be a routine or something else I can do to compare them quickly and easily?
J
Copy Portion Of A Picture To Another Area In Same Picture Object
Let's say I have a Picturebox with with one or more pictures in it (like a single column of pictures aligned one on top of the other) and I want to go into the picturebox at a certain x an y and for a certain w and h and copy that area to the same picturebox at a different x and y. How do I do this? Can I use PaintPicture?
Common Dialog: Import A Picture File Into Picture Box?
I have Picture1 (picture box) and dlgFilePath (common dialog control).
I need the user to be able to browse through his/her computer and find a picture file, which I need a filter for. I know I've done this before, but in a computer transfer, I lost the files, so I'm kinda rusty...
How would I pull that off?
Set the filter, say, for *.bmp, *.jpg, *.gif, *.png files.
I know I need a
Picture1.Picture = FilePath
at the end of all of it to import it... and then I need to change the picture box size to perfectly match the picture...
Thanks in advance!
Pic1.Picture = Pic2.Picture Want To Stop It Flashing!
I have 2 pictures, which I have attached. When I user clicks on the view button on my form then another picture, pic3, is set to either pic1 or pic2 alternately.
The problem is that when this happens there is a green flash where the picture is...something to do with the graphics inverting...
The code for this is:
VB Code:
Option Explicit Public Enum ViewStyle Front = -1 Rear = 0End Enum Private menmView As ViewStyle Public Property Let View(ByVal Value As ViewStyle) menmView = Value LockWindowUpdate UserControl.hwnd If Value = Front Then capView.Caption = "Front" imgWafer.Picture = imgFront.Picture Else capView.Caption = "Rear" imgWafer.Picture = imgRear.Picture End If LockWindowUpdate FalseEnd Property Public Property Get View() As ViewStyle View = menmViewEnd Property Private Sub capView_Click() View = Not ViewEnd Sub Private Sub UserControl_Initialize() View = FrontEnd Sub
I try and lock down the update, but it still flashes. Is there anyway round this...???
Here are the 2 pictures...
Woka
Using Freeimage To Bring In A Picture But A Reduced Version Into A Picture Box
The code below works in that it lets me bring in a tif image into a picturebox. But since the images I have are
8000*8000. I would like to be able to display it more like a thumbnail. Thought maybe stretchdbits could do it?
Am I on the right track or wasting my time trying it that way?
Option Explicit
Const BI_RGB = 0&
Const DIB_RGB_COLORS = 0&
Const LR_LOADFROMFILE = &H10
Const IMAGE_BITMAP = 0&
Private Declare Function SetDIBitsToDevice Lib "gdi32" (ByVal HDC As Long, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal Scan As Long, ByVal NumScans As Long, bits As Any, BitsInfo As Any, ByVal wUsage As Long) As Long
Private Sub Form_Load()
'-- open a TIFF file and put it on the form
Dim dib As Long
Dim bOK As Long
' Load TIF
dib = FreeImage_Load(FIF_TIFF, "c: est.tif", 0)
' Show TIFF in picture1 requires picture box to have autorefresh
Call SetDIBitsToDevice(Picture1.hdc, 0, 0, FreeImage_GetWidth(dib), FreeImage_GetHeight(dib), 0, 0, 0, FreeImage_GetHeight(dib), ByVal FreeImage_GetBits(dib), ByVal FreeImage_GetInfo(dib), DIB_RGB_COLORS)
'tells me the image is 8000*8000
FreeImage_GetHeight(dib), ByVal FreeImage_GetBits(dib), ByVal FreeImage_GetInfo(dib), DIB_RGB_COLORS) MsgBox "Width: " & FreeImage_GetWidth(dib) & ", Height: " & FreeImage_GetHeight(dib)
The part I tried to do to reduce it: I can't run it yet because I am missing SRCCOPY not sure what it is.
Dim picturewidth As Integer
Dim pictureheight As Integer
Dim tempwidth As Integer
Dim tempheight As Integer
picturewidth = 8000
pictureheight = 8000
tempwidth = 1000
tempheight = 1000
Call StretchDIBits(Picture1.hdc, (Picture1.ScaleWidth - picturewidth) / 2, (Picture1.ScaleHeight - pictureheight) / 2, picturewidth, pictureheight, 0, 0, tempwidth, tempheight, _
ByVal FreeImage_GetBits(Picture2), ByVal FreeImage_GetInfo(Picture2), DIB_RGB_COLORS, SRCCOPY)
End Sub
Edited by - AbbydonKrafts on 5/17/2007 7:02:28 AM
Change Picture Frome Existing Picture Shape
IN Word VBA or VB6
I have an inserted picture in my word document,
can i somehow change the picture to an other picturefile
Let say
AppWord.selection.Shapes("Picture 2").... .picture = loadpicture(Appmap & PictName)
IS this possible or should i in word always first delete the original picture object and insert a new one?
Edited by - lvermeersch on 11/22/2005 3:39:59 AM
How To Reduce The Picture Size To Display In Picture Box Control
i have a picture box control on a form. i have to show the picture with other data. the picture is so large that it will occupy the whole screen . so i don't have space to display my data.
please help me
thanks in advance
Edited by - shiva_sgp on 7/12/2004 12:52:30 AM
Store Picture From A Picture Box To MS Access Database Field
Hello All
I am working on a payroll project, Need to store picture of employees in database (Rightnow in Access but need version on SQL too). My query is that how to store picture from a picture box to access database field. There are a lot of stuff about store data from a picture field to another picture field but unable to find any routine for storing dtata from a picture box to picture field.
Secondly if i store picture path in database then how to send that data to Crystal Report 8. Crystal report only show stored pictures.
Now i have to finialize the project and print the Employee Cards with there photographs
A quick response is highly appriciated.
Thanking you all
ahs
Form1.Picture Works, But Command1.Picture Doesnt..
I'm trying to put a picture on a button. I think i must be missing something, because though i can correctly display the picture on the background of a form (set the path of the picture property, to a local BMP file) i cant achieve the same on a command button. Is there something simple that i'm doing incorrectly?
1 Thing About Moving A Picture Inside A Picture Box Control
Hi there! I've a picture inside a picture box control, and when I click the command button, the picture should slide towards the left inside the picture box, meaning that the more it slides to the left, the lesser we'll see of the picture. The thing is : although my picture slides correctly, it never seems to stop even though when it's right coordinate has reached the left coordinate of the picture box! Help!!!!!!
Drawing Picture Exact Size In Picture Box
Hi all,
This has been driving me crazy. I'm trying to draw a picture to the exact size on a picture box. I thought I set up the scale correctly with:
Code:
Picture1.ScaleMode = 5
Picture1.Scale (-3, -3)-(3, 3)
Picture1.Line (1, 0)-(2, 0)
I was hoping this would make a picture box exactly 6 inches square. Just for testing, I drew a line which should measure exactly 1 inch, but when I actually measure it with a ruler, it is 1.125" long. Is there something I'm missing here?
Thanks in advance.
Picture Changing, Picture Transparency And Movement
Im fairly new. I know, or a I think I know, that picture movement is hard? anyways, i want to know how to make an "Image" transparent. I also want to know how to change pictures. for example
private sub button_click()
Change picture1 to picture 2
end sub
(i dont want to have to give it a directory. When I make an exe, im only going to have an exe. im not including any pictures witht he file)
the picture changing i dont really need, and the picture movement i dont really need. but i do need to know how to do transparent pictures.
Making Image1.Picture = A Picture From A Website
Is there anyway I can make, lets say, Picture1.Picture = http://www.asite.com/thepicture.gif ?
I don't know if I need to use Winsock or not, because there are also other controls out there to retreive things from the internet (or http servers sepcifically)
Any help appreciated.
Thanks in advance,
~S0RD3N
How To Set Mouse Inside Picture Box Using Picture Box Coords...?
in my program i want to move the mouse cursor inside a picture box
so when i say setcursorpos x,y
i want it to move the cursor inside the picture box within its xy
not the screens
so say the picture box is in the middle of the screen and i say setcursorpos 4,4 it would put the cursor 4,4 inside the picturebox not on the screen.
PropertyPage Picture To Change Controls Picture, How?
I don't want to use the StandardPicture Property Page that comes with Visual Basic because I want to add stuff to that page, but it won't allow any editing on the standard picture property page, so I created my own Property Page much like it.
I got a dialog box to load from API, using the comdlg32.dll, on the property page, and it puts the picture into the Image Control (Stretched) fine; however, now I'm having difficulty figuring out how to transfer it to my actual control when the user hits the apply button. I've tried 2 different ways of doing this and there were the results of both ways:
Attempt 1:
Code:
Private Sub PropertyPage_ApplyChanges()
SelectedControls(0).Picture = (picBox.Picture)
DoEvents
End Sub
Error Message says: Object doesn't support this property or method.
Attempt 2:
I received a path to the image, and changed it so that:
SelectedControls(0).Picture = (LoadPicture(pathToImageVar))
However, this still gives me the same error message.
I'm VERY SURE that my control has a picture property! Each time the errors pop up, it highlights: SelectedControls(0).Picture = (picBox.Picture) 'or whatever, and it says that (picBox.Picture) = 9003, or some number like that. Each time it is different.
Can somebody point me in the right direction on how to manipulate the picture property of my control (w/o using the StandardPicture Property Page) so that it will change my actual picture in the control when I click apply, to that of the one in the Property page, named picBox?
Thanks
Picture From Database Direct Into A Picture Object
Dear all,
At the moment we are busy with a telephone list, in that list we are also showing a picture of the person. The picture is stored in a table and it's possible to get the picture out of the table and save it on disk.
We are using the code from: http://support.microsoft.com/kb/258038
Is there a posibillity to move the ADODB.Stream of the picture direct to a image of a picture box object?
Nice regards,
Michelle.
VB6 Split One Picture Into Multiple Picture Boxes.
how do i open a bmp or jpeg image into two seperate pictureboxes on the form? eg. half the picture in one box and half in the other? it should be quite simple but i can't find it out.
whatever method is used to do this, can it also be used to split the picture up more? eg. split into vertical quarters and put this into 4 pictureboxes?
Picture Box: Finding Filename Of Loaded Picture
Hi,
I have lots of picture boxes tiled across a form, which have different pictures loaded in them and made visible depending on the user uinput.
Later, i want to get the filename of a picture loaded in a particular box.
How do i go about doing this?
thanks
Center Picture In Picture Box (code Needs Polishing)
Hi,
TO TRY THE CODE: place a picturebox on a form and name it DOWN
I want to use picture box as a command button in order to avoid the focus rectangle when the regular command button is down.
To do that I draw edge at runtime around my picture box (see code below)
The button part works well (picture box looks like the button)
The only part I have trouble with is centering the picture in the picture box. I've got the code from Arron Young and it works on a picture box but when I combine it with my code to draw the edges around the picture box it doesn't center.
Anyway here's the code (the last sub - CenterPicture() is the one I want to use with the rest of my code.... so far unsuccessfully.
VB Code:
Private Declare Function DrawEdge Lib "user32" (ByVal hDC As Long, qrc As RECT, ByVal Edge As Long, ByVal grfFlags As Long) As LongPrivate Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypePrivate Const BDR_RAISEDOUTER = &H1Private Const BDR_SUNKENOUTER = &H2Private Const BDR_RAISEDINNER = &H4Private Const BDR_SUNKENINNER = &H8Private Const EDGE_RAISED = (BDR_RAISEDOUTER Or BDR_RAISEDINNER)Private Const EDGE_SUNKEN = (BDR_SUNKENOUTER Or BDR_SUNKENINNER)Private Const EDGE_ETCHED = (BDR_SUNKENOUTER Or BDR_RAISEDINNER)Private Const EDGE_BUMP = (BDR_RAISEDOUTER Or BDR_SUNKENINNER)Private Const BF_LEFT = &H1Private Const BF_TOP = &H2Private Const BF_RIGHT = &H4Private Const BF_BOTTOM = &H8Private Const BF_RECT = (BF_LEFT Or BF_TOP Or BF_RIGHT Or BF_BOTTOM) Dim ButtonBorder As Long ' picture variable to store Edge type ' Draw picture with edges at startupPrivate Sub Form_Load() DOWN.AutoRedraw = False ButtonBorder = EDGE_RAISED ' draw "button edge" around pictureEnd Sub ' This will make our picturebox look like a PRESSED buttonPrivate Sub DnPressed() ButtonBorder = EDGE_SUNKEN DOWN.RefreshEnd Sub' This will make our picturebox look like a RELEASSED buttonPrivate Sub DnReleased() ButtonBorder = EDGE_RAISED DOWN.RefreshEnd Sub ' Simulate Command_MouseDown() & command_MouseUp()Private Sub DOWN_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Call DnPressedEnd SubPrivate Sub DOWN_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Call DnReleasedEnd SubPrivate Sub DOWN_DblClick() Call DnPressedEnd Sub ' Repaint drawn edges around our picturePrivate Sub DOWN_Paint() Dim r As RECT DOWN.Cls r.Bottom = DOWN.ScaleHeight r.Right = DOWN.ScaleWidth DrawEdge DOWN.hDC, r, ButtonBorder, BF_RECTEnd Sub '**********************************************************************************'**********************************************************************************'**********************************************************************************' Arron Young's code to center picture inside a picturebox THAT NEED'S TO BE INTEGRATED WITH THE ABOVE CODEPrivate Sub CenterPicture() With DOWN DOWN.Line (0, 0)-(.ScaleWidth, .ScaleHeight), .BackColor, BF .PaintPicture .Picture, (.ScaleWidth - .ScaleX(.Picture.Width, vbHimetric, .ScaleMode)) / 2, _ (.ScaleHeight - .ScaleY(.Picture.Height, vbHimetric, .ScaleMode)) / 2 End WithEnd Sub'**********************************************************************************'**********************************************************************************'**********************************************************************************
Return Value Of The Picture Property Of A Picture Box Control
Hi, I am trying to get the return value at runtime of the picture property of a picturebox control. What I want to do is save the name of the image in the picturebox into a string but when I try to do the following;
MyString = Picture1.picture
All I get is a 9 digit number. How can I get the name of the image returned from the picture property.
Thanks
John B
Assing Picture1.Picture To Image1.Picture
Hi,
Is it possible to assign the Picture property of a picturebox to the
Picture property of an image control?
I use an invisble picturebox to make some changes to a picture, but I
want to show the picture in an imagecontrol, since the image is very
large and I want to stretch it.
But when I execute the following code:
Image1.Picture = Picture1.Picture
Image1.Refresh
The image control Image1 stays empty. What am I doing wrong?
Thanks in advance,
Sandra
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
Placing A Picture At A Specific Coordinate In A Picture Box
Greets!
I am trying to place several pictures one after another in a row inside of a picture box. The images are stored in an imagelist.
Here's my test code.
Code:Private Sub Command1_Click()
LWidth = 0
For i = 1 To Len(Text1.Text)
Indx = Asc(Mid$(Text1.Text, i, 1)) - 64
Pic1.CurrentX = Pic1.CurrentX + LWidth
Pic1.Picture = IList1.ListImages(Indx).Picture
LWidth = (IList1.ListImages(Indx).Picture.Width)
Next i
End Sub
I didn't think this would work, and sure enough it doesn't. I end up with the last picture in the top-left corner as I thought I would.
Should I be using an imagebox? Or do I set the X-Coordinate and then print the picture to the picture box? I'm just not sure how to do this.
Any Help would be appreciated!
|