By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,092 Members | 1,344 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,092 IT Pros & Developers. It's quick & easy.

how can i drag/drop a label with the use of an image.

neit
P: 2
hi every one, i'm new at this things in programing (visual basic 6.0).

And i was wondering if i can make an image grab or attach a label to move it around and place it in another place, with the use of an image, i've tried with the mouse drag/drop and works fine. thanks in advance =).
Apr 4 '07 #1
Share this Question
Share on Google+
9 Replies


Dököll
Expert 100+
P: 2,364
hi every one, i'm new at this things in programing (visual basic 6.0).

And i was wondering if i can make an image grab or attach a label to move it around and place it in another place, with the use of an image, i've tried with the mouse drag/drop and works fine. thanks in advance =).
Hello, neit!

Are you hoping to move labels or snapshots at run time? If so, I am not certain, but it does not seem to be possible. Even though a programmer does not lock the controls, at run time, VB keep us from moving stuff around. That's what I think is happening.

If you are hoping to move labels or snapsots in design mode, just make sure your controls are not locked:

(1) Go to Format, with your form showing
(2) Choose Lock Controls

Note: If button is in Form is therefore locked.

Have fun and welcome!

Dököll
Apr 5 '07 #2

Expert 5K+
P: 8,434
hi every one, i'm new at this things in programing (visual basic 6.0).

And i was wondering if i can make an image grab or attach a label to move it around and place it in another place, with the use of an image, i've tried with the mouse drag/drop and works fine. thanks in advance =).
I'm afraid it is not really clear just what you want to achieve, though it's obviously related to drag and drop. Please try to explain a little more clearly, for those of us who are a bit slow. :)

(Have you checked out the DragIcon property?)
Apr 5 '07 #3

Dököll
Expert 100+
P: 2,364
This just in. I snooped around and found vbBeginDrag perhaps this can get you started. Starts up straight away though, perhaps you should look into DragIcon examples...
Apr 14 '07 #4

iburyak
Expert 100+
P: 1,017
Hello, neit!

Are you hoping to move labels or snapshots at run time? If so, I am not certain, but it does not seem to be possible. Even though a programmer does not lock the controls, at run time, VB keep us from moving stuff around. That's what I think is happening.

If you are hoping to move labels or snapsots in design mode, just make sure your controls are not locked:

(1) Go to Format, with your form showing
(2) Choose Lock Controls

Note: If button is in Form is therefore locked.

Have fun and welcome!

Dököll
To move Label-control around a form with your mouse try this:

1. Put Label on a form.
2. Paste code below and run your project.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2.     If Button = vbLeftButton Then
  3.         Label1.Left = Label1.Left + X
  4.         Label1.Top = Label1.Top + Y
  5.     End If
  6. End Sub
3. Try to move label with your mouse.

Good Luck.
Apr 15 '07 #5

Expert 5K+
P: 8,434
I believe the original question was not so much about dragging, as the use (in some way) of an image.
Apr 15 '07 #6

iburyak
Expert 100+
P: 1,017
I believe the original question was not so much about dragging, as the use (in some way) of an image.
The answer was not to original question..... :)

DragIcon property is a correct answer.... LOL
Apr 15 '07 #7

Expert 5K+
P: 8,434
The answer was not to original question..... :)

DragIcon property is a correct answer.... LOL
Perhaps. We won't know whether it's the correct answer unless neit privdes us some feedback.

Hello, Earth to neit...
Apr 15 '07 #8

neit
P: 2
Thanks every one for your your replies, but as you know i am a piece of amateur in VB programing, thanks everyone =)

how can i insert an image, so you can see my proyect form? please tell me

The thing that i need, better i should say; the thing i want to do in my proyect is: with the use of an image to be able to "grab" a label, and place it in another label, so i can get the value of the label (right now i'm using "val()" ); i can drag/drop the label into another label by using the property "dragmode-->automatic" with the mouse and with the code
Expand|Select|Wrap|Line Numbers
  1. 'example
  2. label4.caption=source
  3.  
that way i can get the value of the other label, but because of my lack of knowledge i can't do it the way i want using an image as some kind of " human hand taking a box and place it somewhere else"

i hope you understand me O_o =( thanks everyone
Apr 16 '07 #9

iburyak
Expert 100+
P: 1,017
Look how to do it in VB6. Just change Text1.DragIcon property to some *.ico file you like.

http://msdn2.microsoft.com/en-us/library/xz32ty04(VS.80).aspx

I am not sure thou if you can do the same with a label.
Label doesn’t have interactive interface and doesn’t have OleDropeMode Automatic.
To work around it you can make TextBox look like a label.

Try this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Text1.Appearance = 0
  3. Text1.Locked = True
  4. Text1.BorderStyle = 0
  5. Text1.BackColor = Me.BackColor
  6. Text1.TabStop = False
  7. End Sub
  8.  
  9.  
  10.  
  11. Private Sub Text1_GotFocus()
  12. Text2.SetFocus
  13. End Sub
Good Luck.
Apr 16 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.