简体   繁体   中英

save context menu items in my.settings vb.net

How can I store the items in a context menu strip in the Settings so they are in the context menu when the application is next started?

Or is there a better way than using settings? (they are recently opened files in the cms)

There may be a settings persistence mechanism specifically for this, but if not you need to somehow save the data which will allow reconstruction of the menu strip.

Figure out some metadata that can be saved to a file (XML comes to mind) and then use that to re-build the items upon startup.

Alternately, you may be able to simply persist the serialized menu strip objects to disk.

It's a good idea to save them as user settings. I would save them as a StringCollection (each item of the collection would be a recently opened file path). When your application loads you just have to go through this collection and add corresponding context menu items.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM