|
Hi im trying to get my childforms to show on my mdiparent statusstrip just like programs etc. show in windows on the taskbar. Firstly im struggling to merge the 2 statusstrips that in itself seems to be a challenge unlike the menustrip second i want to put a button on the child statusstrip that you can press to bring the form back to the front when you have multiple childforms open. thirdly i guess i need multiple statusstrips to merge with each forms own bring back to front buttons. Any ideas on this one
|
| intozz Thursday, March 19, 2009 2:34 AM |
anybody got any thoughts on this one? |
| intozz Monday, March 23, 2009 1:50 AM |
maybe you need more info to move this forward tell me the info you need and ill be glad to supply. thanks for the help |
| intozz Wednesday, March 25, 2009 4:11 AM |
Hi,
->get my childforms to show on my mdiparent statusstrip just like programs
When open a childform, add a Item to the parent form’s StatusStrip.
->you can press to bring the form back to the front when you have multiple childforms open.
Add an event to the ToolStripStatusLabel.Click event or button.click event.
EventArgs e)
Form2();
ToolStripStatusLabel lab01 = new ToolStripStatusLabel(f2.Text.ToString());
EventHandler(lab01_Click);
EventHandler(lab01_Click);
EventArgs e)
-> Need multiple statusstrips to merge with each forms own bring back to front buttons
Do you mean one line one item? If so, you can set the LayoutStyle of statusstrip to VerticalStackWithOverflow.If there are too many items, you can set the LayoutStyle to flow.
For more information about LayoutStyle, visit the following web site:
http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstriplayoutstyle.aspx
Hoping that could help you.
If I misunderstood you or you have other questions, please feel free to tell me.
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. |
| Ling Wang Wednesday, March 25, 2009 6:29 AM |
Hi, just to let you know im using vb. So im a little confused first you say add item to mdi parent status strip, add what item? Am i trying to merge status strips here or not? or are you just saying create button on statusstrip of parent form upon opening? if so if tried that and had no success. So the next bit is immaterial because i cant get anything on the statusstrip in the first place. Ive read and seen this:-
http://msdn.microsoft.com/en-us/library/8f8z3ws0.aspx
but not really sure how to go about it. I like mdi parent form but now i kind of get the impression it would be much easier just to run without that and have everything on the windows task bar, its a shame. |
| intozz Thursday, March 26, 2009 3:55 AM |
Hi,
I am sorry for misunderstanding.
I thought you want to implement add an item to the MDIParent form to bring the corresponding form to the front. I gave you another way to implement this function.
Yes, we can use the ToolStripManager.Merge() method to implement merging two StatusStrip controls. But first, the Source and target StatusStip controls need to be different. If you really want to implement merge the same StatusStrip control, you need to add and remove the items by other code.
2>
Click anywhere in the child form, including StatusStrip, will bring the child form to the front. That what I got confused. I thought the “child statustrip�may be the corresponding item in the StatusStrip of main form.
Thisthread is about merge two ToolStrip controls, and this is also working for StatusStrip controls.
And the following is in VB.NET:
Class Form1
Dim f2 As New Form2
Private Sub ToolStripStatusLabel3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripStatusLabel3.Click
Me
End Sub
Private Sub ToolStripStatusLabel4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripStatusLabel4.Click
Dim activeForm As Form = Me.ActiveMdiChild
If Not (Me.ActiveMdiChild Is Nothing) Then
If Me.ActiveMdiChild.Name = f2.Name Then
CType(activeForm, Form2).StatusStrip1, StatusStrip1)
End If
End If
End Sub
Class
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. |
| Ling Wang Thursday, March 26, 2009 9:07 AM |
I tried this and it works, but i was hoping that i could incorporate the statusstrip merge when i fire the form from the toolstrip.
mdiparent
Private Sub Form1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Form1ToolStripMenuItem.Click Dim NewMDIChild As New Form1 NewMDIChild.MdiParent = Me NewMDIChild.WindowState = FormWindowState.Maximized
NewMDIChild.Show()
End Sub
but then it doesnt work. also when i try to have statuslabel on form1 showing form it opens out of the mdiparent.
form1
Private Sub ToolStripStatusLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripStatusLabel1.Click Dim NewMDIChild As New Form1
NewMDIChild.WindowState = FormWindowState.Maximized
NewMDIChild.Show() End Sub
the idea here being it displays the various forms like programs in windows on the taskbar and click them to show them. |
| intozz Friday, March 27, 2009 12:55 AM |
Then you can access StatusStrip of form2 directly.
If f2.Visible Then
Me.StatusStrip1)
End If
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. |
| Ling Wang Friday, March 27, 2009 3:49 AM |
this now merges nicely, thankyou. i have the statusstrip set visible=false on my form1 properties and this for the code
Private Sub Form1ToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Form1ToolStripMenuItem.Click
Dim NewMDIChild As New Form1
NewMDIChild.MdiParent = Me
NewMDIChild.WindowState = FormWindowState.Maximized
NewMDIChild.Show()
Dim activeform As Form1 = Me.ActiveMdiChild
If Not (Me.ActiveMdiChild Is Nothing) Then
If Me.ActiveMdiChild.Name = Form1.Name Then
ToolStripManager.Merge(Form1.StatusStrip1, Me.StatusStrip1)
End If
End If
End Sub
but now i have got to set the toolstripstatuslabel to bring form back
to front instead of this which opens the form outside the mdiparent
Private Sub ToolStripStatusLabel1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ToolStripStatusLabel1.Click
Dim MDIChild As New Form1
MDIChild.WindowState = FormWindowState.Maximized
MDIChild.Show()
End Sub |
| intozz Friday, March 27, 2009 10:32 PM |
I also notice something else here when you close form1 the statustriplabel remains on the mdiparent status strip, i guess i need to handle that in the form closing event somehow |
| intozz Friday, March 27, 2009 11:09 PM |
anybody else got any ideas for this one? thanks |
| intozz Tuesday, March 31, 2009 10:40 PM |
Hi,
Do you mean undoing a merging of two ToolStrip objects when closing the child form? You can use ToolStripMananger.RevertMerge Method. Something likes the following:
Form1-----------------------------------
Dim f2 As Form2
Dim f3 As Form3
Private Sub ToolStripStatusLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripStatusLabel1.Click
New Form2()
Me
New Form3()
Sub
Form2-----------------------------------
Private Sub Form2_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
Me.StatusStrip1)
End Sub
Form3-----------------------------------
Private Sub Form3_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
Me.StatusStrip1)
End Sub
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. |
| Ling Wang Wednesday, April 01, 2009 2:49 AM |
this still doesnt remove ToolStripStatusLabel1 from mdi statusbar
|
| intozz Wednesday, April 01, 2009 10:15 PM |
Could you please post your code or upload your project? Skydrive (http://skydrive.live.com/ ) may be a good option. That will make the issue more clearly.
Besides, you can set the visible property to the control which you want to hide.
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. |
| Ling Wang Thursday, April 02, 2009 2:04 AM |
i uploaded files to skydrive, i think to my public folder? I never used it before, not sure if you need a link or my email addres |
| intozz Friday, April 03, 2009 1:06 AM |
Ok, please give me the link. Thanks.
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. |
| Ling Wang Wednesday, April 08, 2009 5:53 AM |