excel - Drag & drop between frames in VBA -
i'd next in excel/vba form: there 2 frames on form, side side. let's phone call them frame1
, frame2
. within frame1, there other controls, labels text. i'd enable user grab 1 command 1 frame , drag other one, smoothly.
however, command disappears upon dragging out of frame1
. tried fiddle around zorder of command , frames doesn't help. know if possible drag out of frame (on running form, of course) visibly, on top of else?
thanks in advance!
sorry delay, wasn't @ desk yesterday.
i can show have, i'm not sure 'place' solve issue. anyway, have frame1
, frame2
described above, , within frame1
, there label1
. i've given label1
usual mouse events drag , drop:
private x_offset%, y_offset% private sub label1_mousedown(byval button integer, byval shift integer, _ byval x single, byval y single) if button = xlmousebutton.xlprimarybutton x_offset = x y_offset = y end if end sub private sub label1_mousemove(byval button integer, byval shift integer, _ byval x single, byval y single) if button = xlmousebutton.xlprimarybutton label1.left = label1.left + x - x_offset label1.top = label1.top + y - y_offset end if end sub
that of course of study handles drag-and-drop part. i've tried setting zorder of label1
solve this, doesn't much here. of course of study parent of label1 frame it's in, parent property read-only.
meanwhile i've discovered drag-and-drop not problem if place labels not within frames e.g. on top of other labels. guess frames have property of owning that's in them, , ownership not debatable during runtime. if knows way around this, i'd grateful know, @ to the lowest degree have useable alternative.
thanks again!
stepping outside box (no pun intended), might inquire question of why must utilize frame... if strictly visual grouping of elements, can create looks identical using labels. utilize 1 label back, setting caption
blank, , specialeffect
etched. add together sec label caption.
and here how looks @ run time...
as can see, there virtually no visible difference @ run time, using label command frame gives same visual element while bypassing command owner issues inherent frame control.
of course of study there times when frames better, such when using alternative buttons, in case sounds maybe label accomplish goal quite nicely.
hope helps!
excel forms vba excel-vba
No comments:
Post a Comment