MRU Button List in C#
-
Hello everyone. I'm trying to create an MRU button list, similar to the one used in Office 2007 software. I've searched for months and all I can find it MRU list examples using menuItem and menuToolbars. I can't see how this would really be that much more difficult but for some reason, I keep drawing a blank. I have a container like a panel control that will allow for buttons to be dynamically added to it. Any help would be appreciated. Preferably in C# but I can convert from C++ and Visual Basic as well. Thankyou.
-
Hello everyone. I'm trying to create an MRU button list, similar to the one used in Office 2007 software. I've searched for months and all I can find it MRU list examples using menuItem and menuToolbars. I can't see how this would really be that much more difficult but for some reason, I keep drawing a blank. I have a container like a panel control that will allow for buttons to be dynamically added to it. Any help would be appreciated. Preferably in C# but I can convert from C++ and Visual Basic as well. Thankyou.
Well, all you need to do, is track what was recently used, and add to your container, right ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Well, all you need to do, is track what was recently used, and add to your container, right ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
I need to figure out how to create the button dynamically, which I have. But creating a click event for the buttons dynamically is giving me trouble.
-
I need to figure out how to create the button dynamically, which I have. But creating a click event for the buttons dynamically is giving me trouble.
here's my current code to add a button:
public void updateMRU() { // add a new button ButtonItem button = new ButtonItem(filename,"&1 " + filename); button.ImagePaddingHorizontal = 8; button.Tag = filename; menuFileMRU.SubItems.Add(button); //button.Click += new EventHandler(button\_Click); }
The last line to assign an event handler gives me an error before compilation. The name button_Click does not exist in the current context. Every example I've found to create a button and event handler looks like this. If I remark that line out my button does appear in the correct spot with all the information. Why can't I get the EventHandler to work? By the way I'm using DotNetBar and placing the control inside a GalleryContainer, but it allows for buttons and according to Dev Components their Buttonitem is just an overloaded Button control.