PDA

Click to See Complete Forum and Search --> : MRU library


DeadEyes
Jun 3rd, 2005, 02:42 PM
Add an MRU (most recently used) menu to your applications.

usage

Create a Windows Application

Add a reference to the MRUClass.dll

include the namespace
using Menu.Util.MRU;

declare your mru menuitem
private Menu.Util.MRU.MRUMenuItem mru;


in the initialisation section
...
mru = new MRUMenuItem("Recent",3);
mru.MRUEvent+= new MRUEventHandler(MRU_Clicked);
//assuming there is alread a file menu
mniFile.MenuItems.Add(mru);
mru.LoadMRUFile(Application.StartupPath + "\\mru.dat");
...

when an mru menuitem is clicked this method will be called
void MRU_Clicked(object sender,MRUEventArgs e)
{
MessageBox.Show(e.FilePath);
}

every time a file is opened call this method
...
mru.AddItem(fileOpenDialog1.FileName);
...

before closing the application save the current status
...
mru.SaveMRUFile(Application.StartupPath + "\\mru.dat");
...