23-10-12, 04:30 PM
السلام عليكم ورحمة الله وبركاته
****
***
**
*
كود :
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DisableAllButtons(ToolStrip1, True)
End Sub
Public Sub DisableAllButtons(ByVal ts As ToolStrip, ByVal b As Boolean)
Dim i As Integer = 0
For i = 0 To ts.Items.Count - 1
Child(ts.Items(i), b)
Next
End Sub
Private Sub Child(ByVal DDI As ToolStripDropDownItem, ByVal b As Boolean)
For Each itm As ToolStripDropDownItem In DDI.DropDownItems
itm.Enabled = b
If itm.HasDropDownItems Then
For Each it As ToolStripDropDownItem In itm.DropDownItems
Child(it, b)
Next
For Each it As ToolStripMenuItem In itm.DropDownItems
it.Enabled = b
Next
End If
Next
End Sub****
***
**
*

