Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drag a picture from web to container on vb6 form 1

Status
Not open for further replies.

fixmycomputer

Technical User
Sep 29, 2002
2
US
I am new to visual programming and I would Like to create a database of my DVD's with lending tracking, ect. What I would like to do is place a container on the form that I can drop a picture that I dragged from a web page. What kind of container do I need to place on my form and what properties are necessary to achieve this?

Thanks in advance.

Visual Basic 6.0 sp6
Windows XP Pro SP2
 
I think the problem might be that you can't drag and drop and image imbedded in a web page. It may be possible to copy it and paste into a control on a VB form though. Maybe right click the picture and copy it and then write code to paste it into a image control?

Sam
 
I was thinking that my have to be my route. But, I was hoping to pull off what MS Word is able to do. Open up Word, open a web page and you can simply drag a picture from the web page to your document. No copy-paste needed, you don't even have to highlight it as you do with text.

thanks for your suggestion sam

Steve
 
You should be able to do this using a RichTextBox control. Give it a shot!
 
RichTextBox works but you cannot manipulate the picture dropped on it. You can also use a picturebox control or an image control for this purpose.

Start a new project and add a picture box to your form. Set the OLEDropMode property of the Picure box to 1 (Manual).
Insert the following code in Form1.
___
[tt]
Private Sub Picture1_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
If Data.GetFormat(vbCFDIB) Then
Effect = Effect And vbDropEffectCopy
Else
Effect = vbDropEffectNone
End If
End Sub

Private Sub Picture1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Data.GetFormat(vbCFDIB) Then Picture1 = Data.GetData(vbCFDIB)
End Sub[/tt]
___

Now the picture box is able to display any picture dropped on it from Internet Explorer or other applications.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top