Welcome to Dream.In.Code
Become a VB Expert!

Join 149,928 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,833 people online right now. Registration is fast and FREE... Join Now!




droping external image on picturebox

 
Reply to this topicStart new topic

droping external image on picturebox

paritosh_sumrao
24 Dec, 2007 - 05:05 AM
Post #1

New D.I.C Head
*

Joined: 23 Dec, 2007
Posts: 5


My Contributions

Hi friends, I'm doing a catalogue sort of program.
For that I need to drag an external image (.jpeg ,.bmp etc ) and put it on a picturebox. I tried using Oledragdrop ,But not getting the answer.
Help Plz smile.gif


This post has been edited by paritosh_sumrao: 24 Dec, 2007 - 05:06 AM
User is offlineProfile CardPM
+Quote Post

Nayana
RE: Droping External Image On Picturebox
26 Dec, 2007 - 12:53 AM
Post #2

DIC Hawk - 나야나 नयन:
Group Icon

Joined: 14 Nov, 2007
Posts: 824



Thanked: 5 times
Dream Kudos: 175
My Contributions
Could you post the code where you've actually tried to do it.
and code.gif
User is offlineProfile CardPM
+Quote Post

paritosh_sumrao
RE: Droping External Image On Picturebox
26 Dec, 2007 - 05:47 AM
Post #3

New D.I.C Head
*

Joined: 23 Dec, 2007
Posts: 5


My Contributions
QUOTE(Nayana @ 26 Dec, 2007 - 01:53 AM) *

Could you post the code where you've actually tried to do it.
and code.gif

Attached File  drag_drop_1.zip ( 6.77k ) Number of downloads: 61


See the attached zip file.
In the picture box 1 & 3 put some image.
It is in the picture box 5 where I was trying the OleDragDrop.
ThnxAttached File  drag_drop_1.zip ( 6.77k ) Number of downloads: 61

User is offlineProfile CardPM
+Quote Post

Nayana
RE: Droping External Image On Picturebox
26 Dec, 2007 - 05:20 PM
Post #4

DIC Hawk - 나야나 नयन:
Group Icon

Joined: 14 Nov, 2007
Posts: 824



Thanked: 5 times
Dream Kudos: 175
My Contributions
OK, I see you've tried...

Firstly if you are trying to drag files from windows explorer to your VB6 app in Vista it will never work. That's just the way it is. If you have XP or older then you can.

I assume you are trying to drag a picture straight from a folder?

Anyway, you will need to grab the URI of the picture and then load that into the picture box yourself. Here is an example where you can drag files into a listbox (just make a form and put one listbox on it)

CODE

Option Explicit

Private Sub Form_Load()
    List1.OLEDropMode = 1 ' Manual
End Sub

Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Data.GetFormat(vbCFFiles) Then
        Dim i As Integer
        For i = 1 To Data.Files.Count
            List1.AddItem Data.Files(i)
        Next
    End If
End Sub


Another thing. VB6 isn't going to keep working forever... You should download the Express Edition of either C# or VB.net which is free from MS. You can get 2005 edition (maybe), or 2008.

In fact... does anyone have any idea why OleDragDrop doesn't seem to work on Vista???? It doesn't worry me cause I don't use it, but I'd still like to know why...

This post has been edited by Nayana: 26 Dec, 2007 - 11:53 PM
User is offlineProfile CardPM
+Quote Post

paritosh_sumrao
RE: Droping External Image On Picturebox
26 Dec, 2007 - 11:49 PM
Post #5

New D.I.C Head
*

Joined: 23 Dec, 2007
Posts: 5


My Contributions
Thnx Nayana for the reply.
It seems to be working. smile.gif
Do U know how can we save pictures from picturebox in .jpeg or .gif format.
Bcos using savepicture saves in .bmp format.
User is offlineProfile CardPM
+Quote Post

Nayana
RE: Droping External Image On Picturebox
27 Dec, 2007 - 12:03 AM
Post #6

DIC Hawk - 나야나 नयन:
Group Icon

Joined: 14 Nov, 2007
Posts: 824



Thanked: 5 times
Dream Kudos: 175
My Contributions
Once again, if you were using C# or VB.net then there is native support for that.

However, there is an article at vbAccelerator about using the Intel JPEG library which is free, and it also has VB6 wrappers for the DLLs.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 03:09PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month