Skip to main content
GameDev.net gamedev.net
🔒 Locked

Need a little help with Visual Basic

Started by whomshallifear Jan 17, 2002 at 1:47 PM 4 replies 350+ views
Original Post
whomshallifear
whomshallifear
Does anyone know how to place a text box or label over a frame? The first time I did it, it worked fine, but now when I place the label over the frame, it only shows the frame. I''ve tried changing the visibility property and some other things, but can''t get it to work. Any hints?
Bezzant
Bezzant
well, move the frame slightly, then when you can see the edit box (it will be underneath) then right click on the edit box and select "bring to front". or you could just right click the frame and select "send to back"
krez
krez
if you draw the control within the boundaries of the frame, it will be located "in" the frame (i.e. if you slide it around with the mouse it will not be able to leave the frame, and the control''s (x,y) position is relative to the top left of the frame).
if you draw it outside the frame, and then move it on there, it isn''t really "in" the frame, but rather behind or in front of it on the form itself . so, now the zorder matters (zorder is the order in which the controls are on the form; a lower zorder control is drawn in front of a higher one, if they are overlapped). if this is the case, you must make the label or edit box or whatever have a lower zorder than the frame (by using the line "controlname.zorder 0", i.e. "text1.zorder 0").
if you meant to put the control "in" the frame, you have to delete it and draw it again inside the frame.

--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
whomshallifear
whomshallifear
thanks a lot!

ok, one more question. i cant seem to figure out drag and drop. for example, when i run the program, i want to be able to drag and drop a command button or something like that.

anyone know?

Edited by - whomshallifear on January 17, 2002 3:57:19 PM
krez
krez
controls are easy... set the "dragmode" property any controls that can be dragged to "automatic" (the default is manual), and they can be dragged. any place you want them to be dropped, just handle the "DragDrop" event:
Private Sub Form_DragDrop(Source As Control, X As Single, Y as Single)
Source.Left = X
Source.Top = Y
End Sub

that, for example, will put the control wherever you drag it to on the form (of course, it "jumps" a bit because the X & Y you get are the mouse coordinates on the form, and you probably didn''t drag the control by the upper-left corner). that''s the basic of it anyways.
i forget how to make it accept drag-n-drop files and other stuff, though.

--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.