Dynamically build cascading menu from directory structure

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
PGomersall
Posts: 131
Last visit: Thu Feb 15, 2024 12:14 pm

Dynamically build cascading menu from directory structure

Post by PGomersall »

Hi at Sapien,
Have you any examples of dynamically building a cascading toolstripmenu from a simple directory tree (2\3 levels deep) and adding files within the tree as items with click events? Obviously given a set starting root folder.
I am trying to add this kind of structure to a system tray app.
Pete
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Dynamically build cascading menu from directory structure

Post by jvierra »

For this kind of structure we would use a TreeView control. Doing this complex of a structure from a tray app would be disruptive. Just have the tray app open a dialog with a TreeView control.
This topic is 4 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked