-
Mar 15th, 2006, 02:49 PM
#1
Thread Starter
Junior Member
2 forms moving together
Hello guys,
I would like to know, what should I do, to make 2 forms (that are not mdichild) to move together when I move on of them?
For example: Form A is beside Form B. If I move Form A, Form B will move together keeping itself beside Form A.
Thanks for your time,
Kaitem
-
Mar 15th, 2006, 02:55 PM
#2
Re: 2 forms moving together
use a timer... set its interval to 10
Form2.left = form1.left+form1.width
form2.top = form1.top
Doevents:doevents:doevents
isnt the best solutions but it works
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 15th, 2006, 02:57 PM
#3
Frenzied Member
Re: 2 forms moving together
I added the lost and got focus because if you want to be able to move any of the forms and the other to move then you need to disable the timer.
In form1
VB Code:
Private Sub Form_GotFocus()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Form2.Show
Timer1.Interval = 1
Timer1.Enabled = True
End Sub
Private Sub Form_LostFocus()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Form2.Left = Me.Left - Me.Width
Form2.Top = Me.Top
End Sub
In form 2:
VB Code:
Private Sub Form_GotFocus()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 1
Timer1.Enabled = True
End Sub
Private Sub Form_LostFocus()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Form1.Left = Me.Left + Me.Width
Form1.Top = Me.Top
End Sub
Last edited by wiz126; Mar 15th, 2006 at 03:01 PM.
-
Mar 15th, 2006, 03:06 PM
#4
Re: 2 forms moving together
Check out this excellent example:
FormPair by Karl E. Peterson
-
Mar 15th, 2006, 03:08 PM
#5
Re: 2 forms moving together
Check this Link by K E Peterson.
EDIT: i am too lazy. i can never do things on time!!
Last edited by Harsh Gupta; Mar 15th, 2006 at 03:17 PM.
-
Feb 4th, 2023, 01:31 PM
#6
Fanatic Member
Re: 2 forms moving together
Originally Posted by bushmobile
this link is broken, does anyone have this project to attach again?
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
-
Feb 4th, 2023, 01:39 PM
#7
Hyperactive Member
Re: 2 forms moving together
heres the link but the download does not work
https://classicvb.net/samples/FormPair/
-
Feb 4th, 2023, 02:14 PM
#8
Re: 2 forms moving together
-
Feb 4th, 2023, 02:40 PM
#9
Re: 2 forms moving together
You need to process WM_WINDOWPOSCHANGING:
-
Feb 4th, 2023, 06:47 PM
#10
Fanatic Member
Re: 2 forms moving together
Originally Posted by k_zeon
yes,thats why i asked about links.i was looking for the best way to keep two forms together, I found this link, and of course it was broken, it was downloaded in post 8.
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
-
Feb 4th, 2023, 07:21 PM
#11
Fanatic Member
Re: 2 forms moving together
Originally Posted by The trick
You need to process WM_WINDOWPOSCHANGING:
That we have multiple controls in a single project, in each of which windowproc is used, won't there be a problem?
For example, Label Plus has used this mode and we want to add some controls similar to it or have our own separate coding, is there a class that can manage this mode in the best way?
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
-
Feb 4th, 2023, 08:11 PM
#12
Hyperactive Member
Re: 2 forms moving together
Originally Posted by Black_Storm
That we have multiple controls in a single project, in each of which windowproc is used, won't there be a problem?
For example, Label Plus has used this mode and we want to add some controls similar to it or have our own separate coding, is there a class that can manage this mode in the best way?
would be great if you could post a working example. tks
-
Feb 4th, 2023, 08:27 PM
#13
Fanatic Member
Re: 2 forms moving together
I asked a question and I think there is a class for this question, I don't have a lot of experience using this mode and I just want to know if this kind of problem might work better with a professional or advanced class.
Like you, I am waiting to see if there is a class example
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|