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

[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.SetData Pic.Image
SendMessage Rich.hWnd, WM_PASTE, 0, 0

But it does not work??? Why??

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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~

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


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.

How To Copy An Image Several Times Into A Picturebox?
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 A Part Of Image In PictureBox
I would like to copy only a part of image from PictureBox to Clipboard. What should I do?


How Can I Copy PictureBox's Image To Clipboard
I have a program which reads text file and draw it in PictureBox. How can I save this drawing to a bitmap file?
Thank you in advance.

How Do I Copy A Picturebox Image To A Access Table? (Still In Need Of Help :))
I have a picturebox on a form. I need to copy the image in the picturebox to my Access Table. I have a table field set to "OLE Object" so I can store the image. The image will be used later in reports. How may I do this?

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



Keep The Color Of Richtextbox.text On Copy To Another Richtextbox
So, i have 2 richtextbox controls and the text in one of them is colored with different colors (per words like vb editor).When I copy the text to another richtextbox, I lose the colors.How can I keep the colered words?

Does anybody experienced this?


Zooming Various Size Image To Fixed PictureBox Without Changing The Image Ratio
Yup!I need to scale different size image into a fixed picturebox. Without changing the image height vs width ratio.any of you can help me? thanks.
1)scale the image as big as possible depending the fixed picture box height or width.

I use the loadpicture function in loading picture.
If I use the image control, I found the stretch function will cause the image height and width ratio change.


VB6 Linking Picturebox/image To OLE Object Field To Show Image
I think I have set the parameters correctly on the image properties to view the database via the data control but the error report "cannot bind with field picxxx" returns. A text box linked to the next field works OK

Scroll An Image Inside Image Control Or PictureBox?
How do I scroll a picture horizontally inside Image Control or PictureBox Control? Thanks

Richtextbox To Picturebox
I'm trying to get an image of controls contained in one picturebox into another picturebox (for printing). This works for all of my controls except richtextbox. Please see Whenever I try executing this code, which you would think would work, the contents of the richtextbox are not copied to the second picturebox. Has anyone else had this problem?


Drag Image From Listview Into Image Or Picturebox....
I like to search before I post. AFter fumbling throught lots and lots of threads I finally figured out the listview control except how to load image in listview with imagekey I've tried this code

VB Code:
With ListView1        .AllowColumnReorder = False        .FullRowSelect = False        .HideSelection = False        .LabelEdit = lvwManual        .MultiSelect = True        .Sorted = False        .View = lvwReport        .ListItems.Add , [color=DarkOrange]"trash", [/color] Text:="Leave"

"trash" is the imagekey name.........

Next.................... the real question

how do I drag an image from the listview into a image control or picturebox??

I've seen threads on listview------>listview but none for
listview------>picturebox or

[VB] Printing A Richtextbox To Picturebox
Is there any way to take text from a richtextbox and transfer it to a picturebox with the formatting intact?

Conforming Image Size To Picturebox, Not Picturebox To Image Size.
Hello all, i am taking a VB course (Using VB 6) and have run into a little problem.

I need (or want) to have it so users are viewing like... a gallery of the images, on each command button in my frame i have the code
Code: picturebox.picture = loadimage ("imagepath")
(ive run into the issue of running it on another machine and the images not appearing but thats a seperate issue, a seperate topic if i need it eventually)

what ive been able to do is use
picturebox.autosize = true
to make the picture box the size of the image, but thats 4 times as big as the original box and twice as big as my program window (frame?)

ive also tried .scalehight/width but i couldnt get any change with that.

ive searched multiple forums and couldnt find an answer, any help?

thanks in advance

How To Copy A RichTextBox To A RichTextBox
Good Day Guys!

How will i copy the text of one RichTextBox to another RichTextBox with the exact text format?
Please help me if this is possible...
Thanks alot in advance guys!!!

Copy Picturebox To Another Picturebox.

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:

frmCrop.theCrop.PaintPicture pictureOver.Picture, crop1x, crop1y, , , crop2x, crop2y, , vbSrcCopy


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

RichTextBox How To Copy And Paste
Hi, I have a RichTextBox and that I would like to copy charts and pictures to as well as text. How can I implement Paste Special? Do I need to add an OLE Object Container?

Plus I seem to be having trouble with the code to use the Menu commands to copy and paste. How can I immitate ctrl C and ctrl V through the menu?



Copy And Paste [RichTextBox]
hi all,

i have a form in which i made an Editor for formatting the Text, for changing text to

change colors
change font

it works as i want but i want to copy this Formatted Text into another RichTextBox which is in Different Form, both forms are Opened.

im using copy and paste to do it.


Clipboard.SetText RTB.Text
Form1.RTB.Text = Clipboard.GetText

when i use above code it paste the text to Form1.RTB.Text but does not include the Formatting which i made in Different form.

this is the problem.

Copy The Content Of RichTextBox?
The problem I have with the following code is that I can paste to the Word Pad only, and it will not paste to the NotePad . But when If I remove the vbCFRTF, then I can paste it to NotePad but text in Unicode will not be shown properly in NotePad.

VB Code:
Clipboard.ClearRichTextBox2.SelStart = 0RichTextBox2.SelLength = Len(RichTextBox2.Text)RichTextBox2.SetFocusClipboard.SetText RichTextBox2.SelText, vbCFRTF

Any suggestion?

Copy Text To RichTextBox
I have a notepade file (outfile.txt), and i want to make a copy for the text from notepade to a RichTextBox..

How can i do that?


Block Copy Within Richtextbox
i need to have the functionality of copying a block of text from within a richtextbox control. Currently if you start the selection point from a position greater than 0 (ie: left hand margin) and then drag down, the lines below have the selection start point at 0. (and not the same point as where you started)

eg: i would like to be able to copy just the 4th to 5th characters in the text below.


So, my copy block would be

instead of the normal

RichtextBox ---> Cut, Copy, Paste
When I use a TextBox control, at runtime I can right click and Cut, Copy, Paste.
Is there a way to do this in a RichTextBox? Are there settings to change?

Thanks, Hans

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.

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.

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 :

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 :

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

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?

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

IE To RichTextBox Copy-Paste Problem
If I select text in Internet Explorer by pressing Ctrl+A and Ctrl+C , and past inside a RichTextBox It pasts only normal text (without any formatting). But if I select using mouse and press Ctrl+C and then paste inside a RichTextBox, it keeps formatting. Why ?

Is there any way to copy formatted (RTF) text from IE (or WebBrowser Control) to RTB using code ?

I've posted this problem as a 'secondery problem' at But got no answer.
I'm not sure if admin will think it as 'double post'.

IE To RichTextBox Copy-Paste Problem
If I select text in Internet Explorer by pressing Ctrl+A and Ctrl+C , and past inside a RichTextBox It pasts only normal text (without any formatting). But if I select using mouse and press Ctrl+C and then paste inside a RichTextBox, it keeps formatting. Why ?
Is there any way to copy formatted (RTF) text from IE (or WebBrowser Control) to RTB using code ?

RichTextBox Cut/Copy/Paste [Solved]
I have this "texteditor" program that are using a richtextbox!
I have problem with the cut/copy/paste..
When i press in the menU(Cut/Copy/Paste) it works great.

But When i press: CTRL+X (Cut) It runs the cut in the menu, AND it runs it on the RichTextBox!
So if i use the shortcuts keys CTRL+(x)(V)(C) it dosn´t work right!

I found this:
That one fix my problems, but when i exit my program or gets an error it shutsdown Visual Basic!?!?!

Anyone know why this shutsdown vb?
Or are there any other way of disable the CTRL+(X)(V)(C) in the RichTextBox, so it run it from the menu?

How To RichTextBox: Copy VB.NET Method Of Coding
How do you...
1. Change the color of a pre-define text? <screenshot 1 and 2>
2. Prompt the user with a drop-down menu? <screenshot 1>
3. Pop-up a tooltip when a user hovers on a text? <screenshot 2>

Screenshot 1:

Screenshot 2:

Copy Richtext To And From MS Word To RichTextBox
Hey guys,

I've tried in vien and done a bit of a search to find the answer, but to no avail.

I went to send text in rtf to MS Word, perform some automation on the text, then return it in a RTF format. The point being that it returns it's format throughout, i.e. Red Text remains Red, Blue remain Blue.

The code I'm messing with at the mo is:

Set objWord = CreateObject("Word.Basic")

'create a new Word document
objWord .AppMinimize
objWord .FileNew

'inserting textrtf actuially puts rtf source in - this is the first issue
objWord .Insert text1.Text
objWord .AppShow

'perform some automation

'select all text in the new document
objWord .EditSelectAll

'This does not copy the RTF of the Word Doc over - Second issue
text1.TextRTF = objWord .Selection()

Finally... just to save ppl posting as much, I don't want to use a Document Open/Close copy/paste frig if at all possible.

I'd really appreciate any help on this guys. Thanks

How To Copy Richtextbox Contents To Word?
At runtime I want my program to copy the contents of a RichTextBox to MS Word. I tried the Sendkeys option, but it does not work.
What is wrong with the following code?

With RichTextBox1
.SelStart = 0
.SelLength = Len(.RTFText)
SendKeys "^c"
End With
X = Shell("c:Program FilesMicrosoft OfficeOfficewinword.exe", 1)
SendKeys "^v"

Copy Of RichTextBox Content To Clipboard?
How do I copy all the content of the RichTextBox to a clipboard ?

How To Copy Picture Contain Inside A Richtextbox?
Hi everyone i am new here ,

for the pass few day i have found solution to drag and drop a picture into a richtextbox, and after the picture already inside the rich text box i want to separate out the picture and text so when i click in save button it will store it into differ filed inside my access database, do anyone know how to do it?

Copy Text From RichTextBox To Clipboard Problem
Does anyone know why this doesn't work ?

Clipboard.SetText RichTextBox1.SelText

When I execute this code, then click 'paste' into Notepad, for example,
I get the actual code pasted from above, I don't get the text that was selected in the RichTextBox...

Thanks for any help.

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.SetData Picture1.Picture, vbCFBitmap

but when I open up Paint the Paste is still diabled if I do this...

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.

Copyright © 2005-08, All rights reserved