[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 137
  • Last Modified:

Put a jpg image from a custom resource into a 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
0
isnoend2001
Asked:
isnoend2001
  • 2
  • 2
1 Solution
 
FER_GCommented:
to probe this example, you need a pictureBox with an image loaded, a commandbutton (cmdInsertImg)
...
I hope it works for you...
FerG

Saludos.
--
Ing. Fernando D. Giletta
MP: 4035 CIEC
San Fco. Cba. Arg.

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As
Any) As Long
 
Private Const WM_PASTE = &H302
 
 
Private Sub cmdInsertImg_Click()
    ' Put the picture image into the clipboard.
    Clipboard.Clear
    Clipboard.SetData Picture1.Picture
 
    'paste the clipboard content.
    SendMessage RichTextBox1.hwnd, WM_PASTE, 0, 0 
end sub

Open in new window

0
 
isnoend2001Author Commented:
That works, but it takes forever for the form to unload any ideas?
0
 
FER_GCommented:
I don't know what could happend, because it works ok for me...
Did you try the code alone, without any other code but only mine?

FerG

Saludos.
--
Ing. Fernando D. Giletta
MP: 4035 CIEC
San Fco. Cba. Arg.
0
 
isnoend2001Author Commented:
Don't know why either, even put into a new form with no other code, takes about 20 seconds to unload
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now