c# - How can i add to menustrip a recent files menu like in visual studio: File > Recent Files? -


and when move mouse on recent files show open list of recent opened files ?

private void recentfilestoolstripmenuitem_click(object sender, eventargs e)         {             toolstripmenuitem item = new toolstripmenuitem();             item.text = "your file name";             item.click += new eventhandler(youreventhandler);             recentfilestoolstripmenuitem.dropdownitems.add(item);         } 

this recent files menu click event. i'm not sure how make remember recent opened files if close program , opend again.

and how make when move mouse on recent files menu open list.

  1. just create simple txt file in root application folder named recentfiles.txt.

  2. whenever open new file add list complete path.

  3. when open application, read file , populate dropdownlist or wherever want show list.

you can limit recent 5 or 10 items simple logic:

  • read file , populate list(you can use string type list)
  • remove last item of list
  • add current file path first item of list
  • and save item line line file(override file text, not append it)

you can refer this article practical example suggested jens horstmann


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -