Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > [Q] How to copy image from Picturebox into RichTextbox


Reply
 
Thread Tools Display Modes
  #1  
Old 12-18-2002, 08:03 AM
dtt_vn dtt_vn is offline
Newcomer
 
Join Date: Dec 2002
Location: Vietnam
Posts: 14
Default [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??
Reply With Quote
  #2  
Old 12-18-2002, 08:36 AM
Banjo's Avatar
Banjo Banjo is offline
Hell's Angel

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
Default

Take a look at this article at EliteVB.
__________________
A wise one man once said "what you talking about dog breath"
Reply With Quote
  #3  
Old 12-18-2002, 11:00 PM
dtt_vn dtt_vn is offline
Newcomer
 
Join Date: Dec 2002
Location: Vietnam
Posts: 14
Default

thanks
Reply With Quote
  #4  
Old 12-21-2002, 06:15 PM
BryanMiller's Avatar
BryanMiller BryanMiller is offline
Centurion
 
Join Date: Dec 2002
Location: KY
Posts: 132
Default

Paste Picture From PictureBox/Clipboard to Rich Text Box

When you will press the button, the picture box's picture will be copied to the clipboard, and from there will be pasted to the rich text box.

Preparations

Add 1 Command Button (named Command1), 1 Rich Text Box (named RichTextBox1) and 1 Picture Box (named Picture1) to your form.
Add a picture to the Picture Box.

Module Code

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_PASTE = &H302

Form Code

Private Sub Command1_Click()
'the 2 code lines below copy the picture box's picture to the clipboard. if you will omit them,
'the picture that currently found in the clipboard will be copied to the rich text box.
Clipboard.Clear
Clipboard.SetData Picture1.Picture
SendMessage RichTextBox1.hwnd, WM_PASTE, 0, 0
__________________
Everyone has a photographic memory... some just don't have any film.
Reply With Quote
  #5  
Old 01-30-2004, 08:25 PM
iloveuall iloveuall is offline
Newcomer
 
Join Date: Jan 2004
Posts: 4
Question What about vice versa?

I'm eager to know how to copy images from RichTextBox to PictureBox ...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->