Notifications
Clear all
[Closed] constraining label movement in dotnet forms
Sep 11, 2012 8:13 am
How do I constrain a label on a dot net form, so that the user can only move vertically, say?
5 Replies
Sep 11, 2012 8:13 am
I mean – you are the one who coded the movement logic, aren’t you? so just make the x coordinate of the new point constant.
Sep 11, 2012 8:13 am
Thanks Io, but my problem is that , when I code somehing like this to have the label track with the mouse;
fn mouseMovelb sender arg=
(
if arg.button==arg.button.left do
(
sender.location=(sender.parent.PointToClient sender.MousePosition)
lb0.location.y = sender.location.y
lb0.location.x =0
)
)
which works, when the user releases the mouse, the label is constrained to the specified ordinate, but I get an ugly streak as the user drags the label around . I was looking for something cleaner…
Sep 11, 2012 8:13 am
you are changing the location 3 times. Try this
fn mouseMovelb sender arg=
(
if arg.button==arg.button.left do
(
local pt1 = sender.parent.PointToClient sender.MousePosition
lb0.location = dotnetObject "System.Drawing.Point" 0 pt1.y
)
)