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

VB6 RichTextBox Image HELP!

Moderators - Please Delete This Thread

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Image Into Richtextbox

i am trying to draw a chart in an mschart control, and then put that chart into a richtextbox.

i can use the mschart.editcopy method to get the picture out of the chart then use savepicture to save a bmp. rtb.oleobjects.add , , "bla.bmp" will let me stick the bmp into the richtextbox.

bmps are a bit big, so i would prefer the metafile format. if i save as .wmf then using the add method, as above, i get an icon rather than the image itself.

i have also tried using sendmessage with WM_PASTE to paste the picture directly from the clipboard to the rtb. doesnt really work.

i found a post that describes how to convert a metafile directly into rtf, so i will probably use this method.

but i would like to know why neither the add method, nor
WM_PASTE works? also is there a better way to get a picture out of mschart than the editcopy method?

Richtextbox To Image?
Hello again,

I was wondering what would be the best method of converting the entire contents of an RTB to an image? Right now when the rtf is loaded in, its entire content is not immediately shown inside but can be scrolled. I would like to take the entire rtf file/RTB content and put it into an image to be manipulated. I tried .selprint, but I wasn't able to figure out how to copy more than what is first shown.

VB6 RichTextBox Image HELP!
Dear friends,

I want to stop the end-user from being able to reize images that are in the rich text box.

Does anyone know how to stop the resizing?

NOTE: Please do NOT suggest me using the Locked property of the richtextbox. The Locked property will stop the user from resizing the image but it will also stop them from even typing in the textbox! This is useless for me and does NOT solve my problem at all. Before you say its not possible to stop the resizing here is a screenshot of a rich textbox taken from MSN Messenger:

This Messegner screenshot shows that it IS possible to make the textbox still open for text editing and to stop the resizing of the images in it.

So now that we know its possible, does anyone know how to do it?

Richtextbox Image
Hello! I have managed to search the richtextbox and if any of it contains "" then it adds

but, if i type in a secound time it just moves the picture.

Does anyone no how to make a copy of it and not just move it

here is my code

VB Code:
Dim ReplaceLocation As Long        ReplaceLocation = InStr(RichTextBox1.Text, ":)")    If ReplaceLocation <> 0 Then        RichTextBox1.Text = Replace(RichTextBox1.Text, ":)", "")        RichTextBox1.SelStart = ReplaceLocation        Clipboard.Clear        Clipboard.SetData Picture1.Picture        SendMessage RichTextBox1.hwnd, WM_PASTE, 0, 0    End If

thanks in advnce

Richtextbox Image Problem
Hello All.

I'm Currently Making A Chat Program Which Is Working Great. Ive Went To The Extremes And Added Smiles And Things Using Some Great Help -,0057,01/,

I Have It Working Good, When I Type A Smilie, They Are Reciving It And Everything.

However Heres Where The Problem Is, If I Click On The Smilie I Get Image Handles, Where I Can Enlarge And Reduce The Size Of It, Which I Really Dont Want. If I Set The Richtextbox.enabled = false It Works, However Then I Cannot Click My Hyperlinks From Chat.

Does Anyone Know A Solution To Lock The Image Size, Without Disabling The RichTextBox Completely.

Thanks Toothpick

Resizing Image In A RichTextBox
Hello ppl!
I am new here, and I have a problem. I looked around for a solution but the only thing I found in google was a weird-looking module which didn't help me a bit.

The problem is: I am making a text editor and trying to implement a possibility to insert a picture in the text (like in Microsoft Word). It inserts all right but when I am trying to resize it, it gets screwed, losing it's color depth from 24 bit to 256 colors I think. Is it possible to get around this?

Oh and if you need it - I am using this to add picture to the RTB:

Private Sub mnuInsertPicture_Click()
Dim picture As String
On Error Resume Next
dlgedit.CancelError = True
If Err = False Then 'user did not cancel
picTemp.picture = LoadPicture(dlgedit.FileName)
Clipboard.SetData picTemp.picture, vbCFBitmap
If Err = False Then

txtedit.SelStart = Len(txtedit.Text)

SendKeys "+{INSERT}"
End If
End If
End Sub

You may ask me why I am not using OLE Object - the thing is that when I am trying to use it I am getting just an empty field instead of picture and picture opens in Windows Picture and Fax Viewer.

That's it. Anybody can help me with all that stuff?

Embedded Image In A RichTextBox
I have developed a simple word processor using a RichTextBox control with considerable success although many problems were encountered along the way most of which I have resolved by devious means. However two annoyances remain that I would appreciate help with.

1) The purpose of the mini word processor is to create letters for my application to use to print for each selection made from a database in a sort of mail merge process. I can insert text for name and address details by using SelFind to find a marker such as <Name> and SelText to insert the text in place of the marker.

This works fine it is adding a signature stored as a bitmap that is causing the problem as I need to vary the signature dependant on the manager handling the account so cannot pre-insert the bitmap.

What I do is to find the signature marker as I do for a text insert using SelFind then insert the bitmap using this line of coding:-

rtbLetter.OLEObjects.Add , , "Fred Smith.bmp"

I found that this automatically caused my application to turn into MSPaint, so after further research I found that the following code line closes the paint application immediately:-

rtbLetter.OLEObjects..Item(Num).DoVerb -3

Whilst this appears to work the annoyance is that when I run the multiple letter writer part of my application the MSPaint application opens and shuts quickly for each letter printed causing a flicker on the screen that does not look very proffesional. This occurrs even if I reduce the size of the RichText Box to zero height and width and also make it invisible.

2) In order to set a 'Paste' toolbar button enabled after a 'Copy' or 'Cut' is performed I must monitor when this has occurred. I can do this for my own edit menu and toolbar buttons but have no way of knowing if the right mouse button menu is used.

Any suggestions to either or both of the above would be appreciated.

Chris From Dorset, England

How Do You Put An Image Inside A Richtextbox?
Is it possible to add an image inside a richtextbox so that it is visible within the interface and also printable?

Where would I start?

What I am looking to do is fill in text boxes and combo boxes on one side of my form while a richtextbox displays the information on the rightside of my form. Bascially the user is entering in data and a "print preview" invoice is being generated on the right side. The image I want to place in the RTB is my company's logo. Of course this image must print with the rest of the invoice.

- Dan

Insert Gif Image In Richtextbox...
How can i insert animated gif image in richtext box ?
without using sendmessage WM_PASTE.. Need urgent help


Loading An Image Into An Richtextbox
When I add an Image using OLEOBJECT in the Rich Text Box, it pops up with the default Image Editor, which I don't want. Is it possible to stop it?

At the moment I'm opening another form and dragging it into the chat window.

Thanks in Advance.

Create A Image From A Richtextbox

I got a textbox with 2500 values of pixels from a matrix 50x50,they are separated by " "

How i create a image with those values??


Insert Image Into A RichTextBox...and
I manage how to insert image into a richtextbox (edit its RTF and paste the image code inside), but even I've locked the RTB, user still able to resize the image, which is not what I want.
How can I disallow user from resizing the image? I want to work as the same as the Smiles in MSN Messager/ICQ2001b

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

But it does not work??? Why??

RichTextBox Locking Image Sizes
Not an everyday problem, take look:

What I'm trying to do is make all images inserted into a richtextbox have fixed dimensions (in other words you are not allowed to resize them). I have searched everywhere for possible solutions:

+ set the .Locked property to True
/this does not lock image sizes

+ set the .Enabled property to False
/this does lock image sizes but it prevents scrolling and selecting text (which I want to avoid)

+ intercept the WM_MOUSEMOVE message to block resizing
/this message is not fired when you are dragging the handles of an image in a rtb (or at least I could not get it to fire when I needed it to fire)

+ save the locations of the images and when a MouseUp/Down event occurs, check if selstart = any of the imagelocations, if so set the Sellength property to 0
/not bad, but if you start dragging the imaginary image handles before having selected the image, it will still resize because the MouseUp/Down event is fired too late

+ trap the rtb's Change event, if the text hasnt changed then it should mean an image has been resized, that is when you send the Undo message to the rtb (you have to temporarily unlock the rtb for it to work though)
/this method seems the best of the lot, but there's one small handicap: you can see a small "flash" of the image if you resize it to a too big a dimension, because it undoes the change made to the size of that image...

I'm trying to find a way of removing the image size handles, or equally satisfying: blocking the resize when it starts, not fixing it after it has occured.

I'm prepared to do anything to get this to work, subclassing, hooks, you name it, I was hoping someone else might be able to get me started?

If this fails I will have to resort to the "undo" method...

Restrict Image Sizing In RichTextBox
hi gurus,

i want to restrict image resizing in richtextbox.
please help me

Jpg Image From Custom Resource Into Richtextbox
I am trying to get around the hack of putting a picturebox inside another picturebox to get scroll bars for an image.
Can i load a custom jpg directly into a richtextbox if no
Then load the pic into a picturebox and then into RichTextbox

RichTextBox Insert Image While Locked??
I have this code:

VB Code:
For X = 0 To picSmile.UBound     If RTB1.Find(picSmile(X).Tag, tLoc) <> -1 Then          RTB1.SelStart = RTB1.Find(picSmile(X).Tag, tLoc)          RTB1.SelLength = Len(picSmile(X).Tag)          Clipboard.Clear          Clipboard.SetData picSmile(X).Image          SendMessage RTB1.hWnd, WM_PASTE, 0, 0     End IfNext

if the RTB is not locked or disabled.. it works fine...
but I dont want the use to be able to copy or anything in the RTB

with Enabled = False.. all the formatting looks right.. but the images wont insert...

How do I get around this?


Put A Transparent Image Inside Richtextbox
when I put an image with a transparent background inside a richtextbox I get really crazy background colors instead of a white background.

is there a way to make the transparency change to white instead of all kinds of weird colors ?

How Can I Lock The Image Object In RichTextBox
Can you tell me how to lock the image object in RichTextBox when I insert an oleobject image in RichTextBox ,
Such as the input box in MSN messenger.


How Can I Lock The Image Object In Richtextbox
can you tell me how to lock the image object in richtextbox when i insert an oleobject image in richtextbox
such as the input box in MSN messenger.


How To Get An Image From An Embedded OLE Object On RichTextBox ?
Hi all.

I have a RichTextBox control in my application which loads an RTF file.

I know that I can get OLEObjects from RichTextBox using its property OLEObjects, so I can get an embedded OLE object from my RichTextBox like this:

Set obj = RichTextBox1.OLEObjects(1)

But, how can I load the embedded image into a PictureBox ? I don't see any property or method from OLEObject for getting that image.

Can anyone help me, please?

Inserting Image Into RichTextBox's Control
Is it possible to insert image into some kind of static form(control) in RichTextBox?

I know 2 way to insert image like following
Clipboard.SetData LoadPicture(img)
SendMessage rtb.hWnd, WM_PASTE, 0, 0
rtb.OLEObjects.Add , , img

But, upper 2 way has a limit.
In case of insert image, image is too bic because it is not inserted into some control(for example PictureBox)
What I want is to make picture box (or other control) into RTF first, and load image into it.
Is it possible?
Could anybody who know it let me know?

Saving Image From RichTextBox Into ADO Access Database
hello all,

I have a RichTextBox control and want to save the contents of it into Access database using ADODB connection.

Text saves up nicely, but how can I save the images in the RichtextBox as well?

Inserting Image Into RichTextBox's Static Control
Is it possible to insert image into some kind of static form(control) in RichTextBox?

I know 2 way to insert image like following
Clipboard.SetData LoadPicture(img)
SendMessage rtb.hWnd, WM_PASTE, 0, 0
rtb.OLEObjects.Add , , img

But, upper 2 way has a limit.
In case of insert image, image is too bic because it is not inserted into some control(for example PictureBox)
What I want is to make picture box (or other control) into RTF first, and load image into it.
Is it possible?
Could anybody who know it let me know?

Copying Richtextbox To A Richtextbox Including The Boldproperty?
i can copy the text, but how bout the bold property? i'm thinking of reading it letter per letter and see if it is bold.. but is there no other way of making it happen?

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?


Scroll Richtextbox Send Each Line To Another Richtextbox
Well this what I want to do, lets say I have a Multiline Richtextbox1 And I want to send each line from Richtextbox1 to Richtextbox2 one by one untyl it hits last line. And in doing so it keeps the RTF format of richtextbox1 in richtextbox2.

Like this will be the processes,
There 3 line in richtextbox1,
Take line 1 of richtextbox1 sends it to richtextbox2,
Take line 2 of richtextbox1 sends it to richtextbox2


Can't Get Image Admin, Image Edit, Image Scan To Work
Hi Guys,

Every time I go to add components and add the Kodak IMG components it tells me each one cannot be loaded.

I did have it working and then when I re-loaded my project it told me that 'ImgAdmin could not be loaded' and the same with ImgEdit.....'Do you wish to continue loading project anyway'.

Please can you help?...I am in real nead for them to work.

Much thanks,



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

Adding TextRTF Without =&gt; RichtextBox.textRTF = RichTextBox.textRTF&&newpart RESOLVED
I'm making a project that uses Richtextboxes

When I want to add new code to my project I do it this way :

previous = RichTextBox1.TextRTF
leftside = Left(previous, Len(previous) - 6) 'removing the "par }" (will be added again later on)
RichtextBox1.textRTF = leftside & Newcodes & "par }"

This takes a lot of time when I use a lot of pictures because all previous data needs to be re-evaluated by the RichTextBox.

When NORMAL PEOPLE add text to a textbox they do it this way ...

RichtextBox.seltext = NewText

But this can't help me because I'm not adding text.... I'm adding RTF-codes (that can not be done with the RichTextBox standard properties).

But does somebody know how I can add RTFtext without having to read all previous RTFtext ?

Image Control Generates Error If Image's Path Is Assigned To Picture Property
I m storing .jpg file path in a field 'ImagePath' which is of type 'Text' of say table A. Now i want to display that .jpg file whose path is stored in the table A into an Image Control. the picture property of the image control doesn't takes the path string... and prompts an error message that object is required.. ! how to display the image in the Image control.

thanx n regards

How Can I Auto Save Image To Certain Folder After Scanner Scan My Image Into My FORM?
How can I auto save my image to certain folder after scanner scan my image into my FORM?

How to delete the image from the folder when I unload the FORM??


My command button to perform scan function...

Private Sub CmdSCan1_Click()
On Error GoTo ScanErr
'Scan an Image
If ImgScan1.ScannerAvailable = True Then
With ImgScan1
End With

ImgEdit1.Image = ImgScan1.Image 'sets imgedit1 to show scanned image

ImgScan1.CloseScanner 'close scanner
MsgBox "Scanner Not available!", vbExclamation, "Error!"
End If
If Err.Number = 1002 Then 'Exited without scanning
Exit Sub
Exit Sub
End If
End Sub

I want auto save the scanned imange to example

Dim a As String
a = "ScanPic"
MkDir a
Dim b As String
b = "ScanPic" & strTempNo
MkDir b

how can I make sure if the folder I create is exist don't create it again?
because if the folder already exist I will get a error msg "Path and Access error"... duplicate folder created...

Adding Employee Image Files Useing Image Dataype In Sql Server

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

I Need To STOP Image FLICKERING! The Regular Image Control Flickers
So heres the problem....

I'm working on a skinning module for my software and i have menu pages,, on each page i move image controls around so that I can have multiple pages of buttons....

When I click the different menu buttons the images flicker, its not so bad on a fast computer, but on slower computers it really shows.

Does anyone have ANY idea of how to stop this flickering? Ive tried putting the controls on a picturebox / frame, and making the frame invisible/moving it off the screen, but that doesnt work... no matter what I do the images always flicker.

I would use the picturebox because that doesnt flicker,, but it doesnt support transparencies and theres always a box around the image.

Any ideas would be greatly appreciated.


Capture A Control And Send The Image To A Clipboard Or Image File
there is any way to capture a control and send the image of that control to a clipboard or image file?
thanks a lot for your help

(Image Size, Image Adrress, And Creation Time) Of A Process ?
how can I get (Image size, Image Adrress, and Creation time) of a process if I knpw the ID or the handle ?!


Image Capture && Then Draw Line In Coordinates On Captured Image In Vb
I know how to store the image in database but i want to know how to for example :

First Capture an image then allow the user to draw a line as in GRAPH x co ordinate & Y co ordinate on the image
and store this image in the database

Pls help me.


How To Show The Image That Store As BLOB Type On Image Object?
I want to show the picture that be stored in BLOB data type. How can I do?

Inserting Image In Vb Project As Per Database(as Data Changes Image Should Also Change)
i am making front end in vb6 and backend in ms access
i want as my data changes on movenext
concerned photo should also change
i am using data environments

please help

Storing Image In Access Database From Image Control /Picture Box
I am trying to store/retrieve pictures (bmp,jpeg) as fields in a
database record. Other than GetChunk/AppendChunk is there a way to directly
assign the picture to/from a picture control to a database field?
this is b' cos i hv n image in a picturebox/ image control from where i m unable to have the filepath to assign the appendchunk method ..

Pl Help,


Need Help - Disabling Image Resizing Of An Image Inside Of A Rich Text Box
any of you know a way to preventing an image that has been loaded in to a richtextbox to be resized (e.g once the image is loaded its current size / position is locked)

im using
VB 6.0 with SP6

Ms richtext controll 6.0

iv been looking for an answer to this for about a month now

any help would be most apreciated




BitBlt Rendered Image TO Image Control's .Picture
Hi! Is there a way to set an image rendered using BitBlt to an Image control's .Picture property? I've been trying many ways for a while and I can't seem to make it work...

Thanks in advance

How To Convert A Monochrome Image To A Pseudo Colored Image?
Hi Guys,

I need some help here. I have some monochrome (grayscale) images (.bmp format) here and i need to convert them into pseudo colored images making use of a lookup table (LUT).

What's going on here is:
I have some images that have just been captured by an IR Camera. To make these hotspots more visible to the user, I need to match certain temperature higher than a certain threshold to a color say Red.

Since the image is monochrome, the image will consists of the pixel values and not temperature information right? (or is it that this pixel values/intensities of the thermal image are the temperature information?)

So now, how do I create a LUT to match the temperature to a certain pixel value? I am rather confused with this temperature, pixel value and color concept. Can someone help me with this?

Can someone guide me with this conversion of monochrome image to a pseudo colored image? I am stucked here for quite a while now. Your help will be greatly appreciated

Thanks alot guys.....


Save Image From Clipboard To Resized New File Image

I'm trying to make screen captures from Acrobat pages, to create thumbnails with.

I'm doing this by:
1. opening the PDDoc of Acrobat
2. Copy the first page to the clipboard
3. Putting the clipboard image in a Picture variable
4. Stretching it with StretchBlt to a new picture
5. Trying to save the new picture

With the code below, the resulting value for retstretch is 0, thus the stretching didn't work. I don't understand my error. The savepicture method results in nothing. I've found several examples of the StretchBlt method, but all with Pictureboxes. I want to do this without a Picturebox. Is this possible? If not, how can I integrate the pictureboxes in my example?

Thanks in advance! Any help is really appreciated.

Public Sub CreateThumbnail(strFileName As String, Xpixels As Long, Ypixels As Long)
'strFilename = PDF document
'Xpixels = pixel size width
Ypixels = pixel size height

Dim pdfDoc As Acrobat.AcroPDDoc
Dim pdfPage As Acrobat.AcroPDPage
Dim ret As Boolean
Dim pageCount As Long
Dim pdfRectTemp As Object
Dim pdfRect As Acrobat.AcroRect
Dim ClipBoardPic As Picture
Dim pdfPic As New StdPicture
Dim pdfPicWidth As Long
Dim pdfPicHeight As Long
Dim retstretch As Long

' Create the document (Can only create the AcroExch.PDDoc object using late-binding)
Set pdfDoc = CreateObject("AcroExch.PDDoc")

' Open the document
ret = pdfDoc.Open(strFileName)
If ret = False Then
MsgBox "File not found!", vbCritical, "Error"
Exit Sub
End If

' Get the number of pages
pageCount = pdfDoc.GetNumPages()

' Get the first page
Set pdfPage = pdfDoc.AcquirePage(0)

' Get the size of the page
' This is really strange bug/documentation problem
' The PDFRect you get back from GetSize has properties
' x and y, but the PDFRect you have to supply CopyToClipboard
' has left, right, top, bottom
'Set pdfRectTemp = CreateObject("AcroExch.Rect")
Set pdfRectTemp = pdfPage.GetSize

' Create PDFRect to hold dimensions of the page
Set pdfRect = CreateObject("AcroExch.Rect")
pdfRect.Left = 0
pdfRect.Right = pdfRectTemp.x
pdfRect.Top = 0
pdfRect.Bottom = pdfRectTemp.y

' Render to clipboard, scaled by 100 percent (ie. original size)
' Even though we want a smaller image, better for us to scale in VB
' than Acrobat as it would greek out small text
' see

Call pdfPage.CopyToClipboard(pdfRect, 0, 0, 100)

Set ClipBoardPic = Clipboard.GetData(vbCFBitmap)

pdfPicWidth = PixelsToHimetricX(Xpixels) 'Function to convert pixels in HiMetric. Code is not included here
pdfPicHeight = PixelsToHimetricX(Ypixels)

retstretch = StretchBlt(pdfPic.Handle, 0, 0, pdfPicWidth, pdfPicHeight, _
ClipBoardPic.Handle, 0, 0, ClipBoardPic.Width, ClipBoardPic.Height, vbSrcCopy)

SavePicture pdfPic, "c:Temp est.png"

End Sub

Image To A String Im My Application?, And Tell The Width / Height Of An Image?

I wanna do the following in my application

Load a picture into a string,
Tell how wide / tall the image in a PIXELS it is, and if it is less then 150 px's each way load it into my pct box

is this easy or?

[Main problem for now is: i am using:

VB Code:
On Error GoTo ErrorSub:    Me.CommDia1.Filter = "Avatar Image Files (*.gif)|*.gif"    Me.CommDia1.InitDir = App.Path & "Avatars"    Me.CommDia1.ShowOpen    Dim aFileName As String, strAvatar As String    aFileName = Me.CommDia1.FileName    If Len(aFileName) > 0 Then        strAvatar = LoadPicture(aFileName)        imgAV(0).Picture = strAvatar    End IfExit SubErrorSub:    If Err.Number = "32755" Then        ' It's a Cancel Error, Just Ignore it        ' And Exit the SubRoutine        Exit Sub    ElseIf Err.Number = "76" Then        ' Avatar Directory Doesn't Exsist, Lets Make It        MkDir App.Path & "Avatars"        Err.Clear        Resume Next    Else        MsgBox "Error: " & Err.Description, vbOKOnly, "Error # " & Err.Number        Err.Clear    End If

And strAvatar isn't dimmed as the correct type,,, whats the correct type for the Picture?

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

How To Pass Image Name To Image Control In Data Reports
I want to set the image to image control in Data reports.
Here the thing is, i don''t want to set image through properties window.I want to change the image based on condition in view code. I am not able set the name in view code of datareport
I would like to set the image name as

if productid="app101" then
image. ="apple.jpg"
end if

here my intention is, i want to display image for each product which are stored in a folder and whose name are kept in databse...

Since there is no option to bind image control to databse field, we have to select image to imagecontrol dynamically...

Copyright 2005-08, All rights reserved