CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Simple drag & drop of images

    Any detailed article on the issue of implementing interface with drag & drop capability of image over other image? NOT OLE drag & drop!
    I searched MSDN CD but I didn't found any good example or explanation of techniques.

    Michael Vlastos
    Automation Engineer
    Intracom, Research & Development Division
    Development Programmes Department
    Athens, Greece

  2. #2
    Join Date
    Apr 2001
    Posts
    8

    Re: Simple drag & drop of images

    I may be able to help you. But I don't understand EXACTLY what you want to do.

    Could detail it more, please.


  3. #3
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Re: Simple drag & drop of images

    Thank you. For example: I have a picture box with an image on it and next to it I have a 'control panel' with some available images (gif) and I want the user to be able to drag and drop how many images he wants from this control panel over the picture box with the image.

    Michael Vlastos
    Automation Engineer
    Intracom, Research & Development Division
    Development Programmes Department
    Athens, Greece

  4. #4
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Simple drag & drop of images

    I wrote a program to do what you wanted. The actual code is very small. But still I have to post the whole form code.
    You'll get an error while loading, simply replace the images in the pictureboxes.



    VERSION 5.00
    Begin VB.Form Form1
    Caption = "Form1"
    ClientHeight = 8175
    ClientLeft = 60
    ClientTop = 345
    ClientWidth = 9495
    LinkTopic = "Form1"
    ScaleHeight = 545
    ScaleMode = 3 'Pixel
    ScaleWidth = 633
    StartUpPosition = 3 'Windows Default
    Begin VB.PictureBox picPanel
    Appearance = 0 'Flat
    AutoRedraw = -1 'true
    BackColor = &H80000005&
    ForeColor = &H80000008&
    Height = 6255
    Left = 6000
    ScaleHeight = 415
    ScaleMode = 3 'Pixel
    ScaleWidth = 143
    TabIndex = 1
    Top = 480
    Width = 2175
    Begin VB.PictureBox picMotif
    Appearance = 0 'Flat
    AutoRedraw = -1 'true
    AutoSize = -1 'true
    BackColor = &H80000005&
    ForeColor = &H80000008&
    Height = 2175
    Index = 2
    Left = 360
    Picture = "Form1.frx":0000
    ScaleHeight = 143
    ScaleMode = 3 'Pixel
    ScaleWidth = 175
    TabIndex = 4
    Top = 4440
    Width = 2655
    End
    Begin VB.PictureBox picMotif
    Appearance = 0 'Flat
    AutoRedraw = -1 'true
    AutoSize = -1 'true
    BackColor = &H80000005&
    ForeColor = &H80000008&
    Height = 2280
    Index = 1
    Left = 360
    Picture = "Form1.frx":2218
    ScaleHeight = 150
    ScaleMode = 3 'Pixel
    ScaleWidth = 175
    TabIndex = 3
    Top = 2040
    Width = 2655
    End
    Begin VB.PictureBox picMotif
    Appearance = 0 'Flat
    AutoRedraw = -1 'true
    AutoSize = -1 'true
    BackColor = &H80000005&
    ForeColor = &H80000008&
    Height = 1635
    Index = 0
    Left = 360
    Picture = "Form1.frx":4868
    ScaleHeight = 107
    ScaleMode = 3 'Pixel
    ScaleWidth = 125
    TabIndex = 2
    Top = 240
    Width = 1905
    End
    End
    Begin VB.PictureBox picDest
    Appearance = 0 'Flat
    AutoRedraw = -1 'true
    BackColor = &H80000005&
    ForeColor = &H80000008&
    Height = 6255
    Left = 600
    ScaleHeight = 415
    ScaleMode = 3 'Pixel
    ScaleWidth = 327
    TabIndex = 0
    Top = 480
    Width = 4935
    End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = false
    Attribute VB_Creatable = false
    Attribute VB_PredeclaredId = true
    Attribute VB_Exposed = false
    private Sub picDest_DragDrop(Source as Control, X as Single, Y as Single)
    Dim lft as Integer, tp as Integer
    lft = Left$(Source.Tag, 5)
    tp = Right$(Source.Tag, 5)
    picDest.PaintPicture Source.Image, X - lft, Y - tp
    End Sub

    private Sub picMotif_MouseDown(Index as Integer, Button as Integer, Shift as Integer, X as Single, Y as Single)
    picMotif(Index).Tag = X & " " & Y
    picMotif(Index).Drag vbBeginDrag
    End Sub





  5. #5
    Join Date
    Apr 2001
    Posts
    8

    Re: Simple drag & drop of images

    I have sent you an E-mail containing a simple VB project I haev created, tell me if you haven't recieved it.


  6. #6
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Re: Simple drag & drop of images

    Thank you very much! exactly what I wanted!

    Michael Vlastos
    Automation Engineer
    Intracom, Research & Development Division
    Development Programmes Department
    Athens, Greece

  7. #7
    Join Date
    Jul 2001
    Posts
    1

    Re: Simple drag & drop of images

    can i get a copy of this email as well?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured