473,499 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Move controls around form at runtime?

Hi,

I am looking to create an eLearning resource using VB2008. I have a
form with a background picture of a cross section of a strand of hair
magnified x1000. The around the edge of the hair strand there are
empty boxes. The boxes are part of the background image (jpg).

The user drags a command button, labelled, for example, 'Hair
Follicle' over to an empty box and drops 'within'. This process is
repeated for the remaining command buttons / labels. So in essence,
the user is simple moving command buttons to other locations on the
form but the background image gives the illusion that they are
dropping the labels in empty boxes.

I have managed to use the following code to move the command buttons
around the form and I can position them over the empty boxes
sucessfully.

Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
If e.Button = System.Windows.Forms.MouseButtons.Left Then
Button1.Capture = False
Dim msg As Message = Message.Create(Button1.Handle,
WM_NCLBUTTONDOWN, _
New IntPtr(HTCAPTION), IntPtr.Zero)
Me.DefWndProc(msg)
End If
End Sub

I would like the command buttons to snap into place when they are
dropped. Is this possible? I would also like to test if the command
buttons are dropped onto the correct labels and feedback given to the
user in the form of a dialog box.

Any ideas? Any help is much appreciated.

Thanks,
Paul
Nov 20 '08 #1
0 2499

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
9279
by: Sagaert Johan | last post by:
What is the cleanest and most efficient way to move a button or picture around the form at RUNTIME ? I want to achieve similar results like the form designer at design time. Johan
4
6709
by: Chuck Ritzke | last post by:
Hi, I've searched the newsgroup and other sources to understand how to handle runtime controls and see I'm not the only one who's confused, but I'm still not quite sure of the best way to handle...
4
5674
by: Nancy | last post by:
BlankI'm new to VB.NET and OOP and have been reading and surfing the web in an attempt to learn and understand. At this point I'm spinning my wheels and wasting time. I want to be able to move a...
3
4476
by: Jacob Thastrup | last post by:
Hi This is propably easy to answer but how do I make sure that my controls stay in a certain area of my form. Right now if I maximize my form the controls will stay in their original position and...
10
3058
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
1
1249
by: Maya | last post by:
Hello everyone, I have a windows form that has 2 child usercontrols i created and added inside, control1 has a label that displays some text based on activities i do in control2, my question is...
0
2405
by: hmm | last post by:
Hi all I have two problems: Problem #1: I'm using a .NET Form with the property 'FormBorderStyle' set to 'None'. The idea is to completely cover the area of that Form with a UserControl. In...
3
2369
by: mattgcon | last post by:
I was curiuos if anyone knew of a way to allow drag and drop functionality on the actual controls themselves during runtime within a Windows Application. I want to allow the user to customize a...
8
3077
by: jmarcrum | last post by:
I have a table with about 100 records. The user has the ability to click a button on the main form that will open up a "move to the next year" form. A query displays all 100 records on the...
0
7128
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7385
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4917
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.