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 ;)
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
Re: 2 forms moving together
Check out this excellent example:
FormPair by Karl E. Peterson
Re: 2 forms moving together
Check this Link by K E Peterson.
EDIT: i am too lazy. i can never do things on time!! :mad:
Re: 2 forms moving together
Quote:
Originally Posted by
bushmobile
this link is broken, does anyone have this project to attach again?
Re: 2 forms moving together
heres the link but the download does not work
https://classicvb.net/samples/FormPair/
Re: 2 forms moving together
Re: 2 forms moving together
Re: 2 forms moving together
Quote:
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.
Re: 2 forms moving together
Quote:
Originally Posted by
The trick
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?
Re: 2 forms moving together
Quote:
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
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