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.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Copy Picture From 1 PictureBox To Another
Hey all
How can i copy a picture from 1 PictureBox to another?
if i'm using:
picture2.picture = picture1.picture
its aint working (cuz i'm usin ExtractAssociatedIcon)
any other way?
Copy Picture From Picturebox To Image Control?
well, I want to copy a picture from a picturebox to an image control, but I also want to resize the picture to a smaller size. Image box doesn't have a paintpicture method and BitBlt and those functions don't work with it. I dont want to use the stretch property of the image control because the real image inside the image control wouldn't resize that way. SO, how can I use BitBlt or any other function doing the same thing on an image control?
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
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
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?
Copy Picturebox To Another Picturebox.
Hi!
I am making a paint program and i have made a crop tool witch works like this:
Press somewhere on the picture to select the first X and Y valuesMouseUp to get the final X and YCopy the picture inside the 4 points to another forms pictureboxShow that form
The current code:
Code:
frmCrop.theCrop.PaintPicture pictureOver.Picture, crop1x, crop1y, , , crop2x, crop2y, , vbSrcCopy
frmCrop.Show
The result is a empty picturebox in the frmCrop (the form where the new picturebox is).
Any suggestions?
Copy Picturebox 2 Other
I am gettin confused!
How do i copy the content of a picturebox to other picturebox?
I have a bitblt putting in an image into pic1 , when it copies both get white!
Copy Picturebox
Hello All Members
How can i copy the content of a picturebox to another Picture box
Thanks alot for advice
Egyptian Man
Edited by - khaledagwa on 9/23/2004 1:37:15 PM
Copy A Bytearray Into A Picturebox
Hi there!
I've got a bytearray bytPicture() which contains bitmap data (copy of the data as a bmp is stored on disc).
Now I want to show this picture in a picturebox or whatever without saving it to disc!!
Can anyone help me?
TIA Daniel
Copy PictureBox From One Form To Another From
Please Help!!
Hi everyone, I have an app written in vb 6 that displays a form with multiple PictureBoxes, I need to break the code into smaller chunks, so for every PictureBox for example, I have a its own separate form with a PictureBox with code attached, at run-time I need to copy these PictureBoxes controls from their forms onto the main form any help or suggestions will be very grateful, the reason is so the work can easily be divided between multiple programmers.
Thanks
Copy Selection In Picturebox
Hello guys!
This is probably a very dumb question, but I did not get any sleep the last couple of days..
I have 2 pictureboxes. In one picturebox I select an area with this code :
Code:
Option Explicit
Dim StartX As Single 'Starting X Position
Dim StartY As Single 'Starting Y Position
Dim EndX As Single 'Ending X Position
Dim EndY As Single 'Ending Y Position
Dim DrawBox As Boolean
Private Sub Pic_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
pic.Cls 'Clear The Previous Box
If Button = vbLeftButton Then 'If Left Is Pressed
'Store Coordinates
StartX = X
EndX = X
StartY = Y
EndY = Y
DrawBox = False
End If
End Sub
Private Sub Pic_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then 'If Left Button Is Pressed
pic.DrawMode = vbInvert 'Invert The Line
If DrawBox Then 'If
pic.Line (StartX, StartY)-(EndX, EndY), , B
End If
pic.Line (StartX, StartY)-(X, Y), , B
EndX = X
EndY = Y
DrawBox = True
End If
End Sub
Now, I want to copy the selection into another picturebox. How can I do this ¿
I tried BitBlitting, but it did not produce any results. This is what I attempted :
Code:
'APIs declarations omitted
Private Sub Command1_Click()
Dim hTmp As Long 'DC in memory
Dim hBitmap As Long 'Bitmap to be associated with the DC
'Create a DC with the same settings as the picturebox
hTmp = CreateCompatibleDC(pic.hdc)
'Do this. Also set the AutoRedraw of the Form to true
Me.ScaleMode = vbPixels
'If the DC was created...
If hTmp Then
'Obtain a bitmap with compatible settings
hBitmap = CreateCompatibleBitmap(pic.hdc, pic.Width, pic.Height)
If hBitmap Then
'associate this bitmap with the DC
SelectObject hTmp, hBitmap
'Copy the picture from Picture1 on to the memory DC
BitBlt hTmp, 0, 0, pic.Width, pic.Height, pic.hdc, 0, 0, vbSrcCopy
'Now copy it back to the Form
BitBlt Pic2.hdc, 0, 0, pic.Width, pic.Height, hTmp, 0, 0, vbSrcCopy
End If
End If
'Remove these objects now
DeleteObject hBitmap
DeleteDC hTmp
End Sub
But, Picturebox2 did not show anything. How can I copy only the selection on Picturebox1 to picturebox2 ¿
Any help would be greatlt appreciated.
How Do I Copy A Form To A PictureBox?
I thought I was so original when I came up with the idea of using PrintForm to output a formatted page until I realized that it crops the output to what is visible. My next idea is to use:
Call Printer.PaintPicture(Picture1.Picture, X, Y)
Assuming I can copy the form to the PictureBox, I think this would work? I tried Picture1.Picture=Form1.Image but that's not the right code.
Copy PictureBox Content From Another App
Is it possible to get the Picture from a PictureBox control in another application and either copy it to a PictureBox, or save it as a file? Be good. If you can't, don't get caught!
Copy A Picturbox To Another Picturebox
I have pictureBox with some objects inside.
I want to copy all the objects (as they appear in the picturecox) to another picturebox.
How can i do that?
And another thing, can I print items placed picturebox, but their location is out of the picture borders?
Mschart Copy To Picturebox
I am attempting to copy an Mschart (MscCompanySummary) result into a PictureBox control (PictPrint)...Here's what I have so far:
'------- Copy chart to clipboard -------
MscCompanySummary.EditCopy
'------- Copy the clipboard to the PictureBox-------
PictPrint.PaintPicture Clipboard.GetData(), 0, 0
At this point, I have had little success: I can see the clipboard copy of the chart "Flash" into the Picturebox, but it then blanks back out...Any Ideas?
Also, once this is accomplished, I want to print the picture: Is the following correct?
Printer.PaintPicture PictPrint.Picture, 50, Printer.CurrentY
Any help is greatly appreciated.
J Morgan
Copy A Picturebox From One Form To Another
How can I copy a picturebox WITH contents from one form to another?
The first form is visible, the second one will be loaded but not shown.
I'm trying to use this to perform a print.
Copy Portion Of A Picture From Picture Box
http://support.microsoft.com/kb/242018
from the above link, i am getting an error of "Editor"
Editor.Pic_Edit.Line (OrigX, OrigY)-(DestX, DestY), , B
in the above line, what is this Editor keyword
from the above article, the program is not function, please have a look
Public Const INVERSE = 6
Public Const DOT = 2
Public Const SOLID = 0
Public OrigX As Long
Public OrigY As Long
Public DestX As Long
Public DestY As Long
Public Sub Draw_Selection_Rectangle()
' Set drawing mode to INVERSE since this routine also used to erase
' the selection rectangle by simply drawing over the currently
' displayed rectangle
With Editor.Pic_Edit
.DrawMode = INVERSE
.DrawStyle = DOT
Editor.Pic_Edit.Line (OrigX, OrigY)-(DestX, DestY), , B
.DrawStyle = SOLID
End With
End Sub
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
How Can I Copy The Images In A RichTextBox To A PictureBox??
There are some text and images in the RichTextBox.
I can copy the text in RichTextBox to other control using SelText.
But I don't know how to copy the images in RichTextBox to PictureBox ...
Please, help me.
Thanks for reading, HAVE A NICE DAY~
[Q] How To Copy Image From Picturebox Into RichTextbox
Hi all.
Please tell me How to copy an image ( from picturebox ) to richtext box? I try to use this code like :
Clipboard.Clear
Clipboard.SetData Pic.Image
SendMessage Rich.hWnd, WM_PASTE, 0, 0
But it does not work??? Why??
Copy Image From PictureBox To Array.
Hi all, i need to copy a image from a picture box to Array or memory. Better array because i'll manage RGB pixels directly with a variable.
What i need is a fast metod because i need to process very longs sequence of image almost to 640x480 pixels and GDI getpixel or VB point fun is too slow.
Is possible to use also MCI to get a frame in to picturebox without overlya that make impossible to read frame with getpixel?
Thanks and sorry for English.
Renato T.
Send An Image Copy At 75% To Picturebox
Form 1 has a textbox containing the text for an image pathway.
I want a click command1 event to send a COPY of the image at this pathway, at 75 % of original size to a picturebox on form 2
How do I do this,please?
Thanks in advance
Dave
Copy Image From PictureBox To Array.
Hi all, i need to copy a image from a picture box to Array or memory. Better array because i'll manage RGB pixels directly with a variable.
What i need is a fast metod because i need to process very longs sequence of image almost to 640x480 pixels and GDI getpixel or VB point fun is too slow.
Is possible to use also MCI to get a frame in to picturebox without overlya that make impossible to read frame with getpixel?
Thanks and sorry for English.
Renato T.
BitBlt To A Picturebox Then Copy To Clipboard
OK, I can BitBlt an image into a Picture1.hDC but how do I then save it on the ClipBoard?
I have tried this...
Clipboard.Clear
Clipboard.SetData Picture1.Picture, vbCFBitmap
but when I open up Paint the Paste is still diabled
...so if I do this...
Clipboard.Clear
Clipboard.SetData Picture1.Image, vbCFBitmap
...then when I open Paint the Paste is enabled but clicking on it only gets what was originally in Picture1 and not what I BitBlt'd into it.
I have this same exact problem using SavePicture.
How To Copy An Image Several Times Into A Picturebox?
well..
I think the subject says everything...
but anyway, I need to copy an image 6 times into a PictureBox and before that, i need the user to enter the horizontal and vertical spacement...
it must be in two columms and three lines
thanks a lot
Copy Contents Of Picturebox To Clipboard
I'm trying to copy a picture from my form - the picture contains lines drawn in using the line commands and pset paint dots. When I use this command, it copies the background only (the picturebox without contents). How do I copy the picture with lines and dots? Thanks in advance.
VB Code:
If Picture2.Visible = True ThenClipboard.ClearClipboard.SetData Picture2.Image, vbCFBitmapEnd If
How Do I Capture An RTFbox Contents And Copy That Into A Picturebox
Hello,
I am trying to capture the contents of an RTF box, which has been placed within the bound of a 'CopyBox' Shape, which lies in a PictureBox.
I have successful placed/edited text in the RTFBox as is should look in the Holding PictureBox image. I don't quite know how to capture the image within the bounds of the CopyBox to copy back into the PictureBox.
I tried the following below: (This did not capture the image area that I wanted. I do want to maintain the resolution that is found in the rtfbox when 'pasting' it back into the PictureBox.
==========================
Function CaptureImage()
Dim myDC as long
myDC = GetDC(RTFBox1.hWnd)
ClipDataPic.Width = ScaleX(CopyBox.Width, vbPixels, vbTwips)
ClipDataPic.Height = ScaleY(CopyBox.Height, vbPixels, vbTwips) Call BitBlt(ClipDataPic.hdc, 0, 0, CopyBox.Width, CopyBox.Height, myDC, CopyBox.Left, CopyBox.Top, SRCCOPY)
ClipDataPic.Refresh
CopyBox.Visible = False
Clipboard.Clear
Clipboard.SetData ClipDataPic.Image, vbCFBitmap
End Function
======================
Any ideas?
Scott.
Copy The Content Of PictureBox Control To Clipboard
Hi guys,
I draw a line in a PictureBox control (picMyPicture) as follows:
----------------------------------------------
Dim Xo, Yo, Xmax, Ymax
picMyPicture.Cls
Xo = 0
Yo = 0
Xmax = picMyPicture.ScaleWidth
Ymax = picMyPicture.ScaleHeight
picMyPicture.Line (Xo, Yo)-(Xmax, Ymax)
----------------------------------------------
I wish to copy the content (which is the 'line' in this case) to clipboard so that I can paste it into Microsoft Paint. Please advise how I can do that.
TQvM
Controls Replaced With PictureBox When I Copy The App Into Other System
Dear Friends,
I have designed a small Application using VB and i used some ActivexControls/Components like DataGrid, FlexGrid, etc etc.
My application running well in my system where i developed.
Recently i copied the entire application (.frm, .vbp etc) into a floppyand dumped into another system at my friends place, i found manycontrols are been replaced with Picture Box control. What should i do toavoid this? Pls help
Pratap
How To Draw (copy) A Control's Image In A Picturebox
Hi everyone,
I need help with a project I'm working on.
Is there a way to get a control's image (instance) even if it isn't visible, and copy it in a picturebox?
I've tryed with bitblt and getdc etc...but nothing is working...
The reason that I need this, is because I want to make a mask for the control, so it can be transparent.
Thnx.
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 can´t 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...
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
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?
|