Snapping Forms together

Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Dec 2007
Posts: 17
Reputation: Mr Brownstone is an unknown quantity at this point 
Solved Threads: 1
Mr Brownstone's Avatar
Mr Brownstone Mr Brownstone is offline Offline
Newbie Poster

Snapping Forms together

 
0
  #1
Apr 5th, 2008
Hey everyone, I am currently making a Media player project and so far it is going really well. It is pretty much a combination of WMP, Itunes and Winamp and everything is working so far apart from one thing I want to include in the program.

I tried looking for solutions but got no where. I basically currently got 2 forms. One form is the main player and one is a playlist form.

What I want is when I click a lock button on the playlist it will snap the two forms together. Aswell as this I want it so it stays locked even when I move the player form around. I have the moving code working.

Because I can't really explain it I drew a (really) rough diagram of what I want to achieve:
http://img178.imageshack.us/img178/4817/lockgt2.png

does anyone have a idea how I can achieve this?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 169
Reputation: ptaylor965 is an unknown quantity at this point 
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: Snapping Forms together

 
0
  #2
Apr 5th, 2008
Try
  1. 'In the forms event (Me.Move) of Form1
  2. If Locked = True Then 'Locked as Boolean (Global)
  3. Form2.Left = Me.Left + Me.Width
  4. Form2.Top = Me.Top
  5. End If
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 17
Reputation: Mr Brownstone is an unknown quantity at this point 
Solved Threads: 1
Mr Brownstone's Avatar
Mr Brownstone Mr Brownstone is offline Offline
Newbie Poster

Re: Snapping Forms together

 
0
  #3
Apr 8th, 2008
Thanks a lot, It works perfectly.

I just had to include:
Me.Left = Player.Left + Player.Width
Me.Top = Player.Top
into the button click also so it locked the forms when the button was pushed not just when the form was moved.

Thanks again
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC