Click here to Skip to main content
15,885,435 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to disable scroll in menu on visibility change Pin
Wendelius23-Jul-08 4:57
mentorWendelius23-Jul-08 4:57 
GeneralRe: How to disable scroll in menu on visibility change Pin
AndrusM23-Jul-08 4:04
AndrusM23-Jul-08 4:04 
GeneralRe: How to disable scroll in menu on visibility change Pin
Luc Pattyn23-Jul-08 4:18
sitebuilderLuc Pattyn23-Jul-08 4:18 
GeneralRe: How to disable scroll in menu on visibility change Pin
AndrusM23-Jul-08 4:30
AndrusM23-Jul-08 4:30 
GeneralRe: How to disable scroll in menu on visibility change Pin
Luc Pattyn23-Jul-08 4:46
sitebuilderLuc Pattyn23-Jul-08 4:46 
GeneralRe: How to disable scroll in menu on visibility change Pin
AndrusM23-Jul-08 5:36
AndrusM23-Jul-08 5:36 
GeneralRe: How to disable scroll in menu on visibility change Pin
Luc Pattyn23-Jul-08 6:04
sitebuilderLuc Pattyn23-Jul-08 6:04 
GeneralRe: How to disable scroll in menu on visibility change Pin
AndrusM23-Jul-08 6:57
AndrusM23-Jul-08 6:57 
CopyTo() copies only top level menu items. Child items are not copied. So child items are destroyed i sLoad and not restored if new user logs in
How to clone whole menu tree ?

partial class MainForm : Form {
//
ToolStripItem[] Copy;
//
protected override void OnLoad(EventArgs e) {
  Copy = new ToolStripItem[MainMenuStrip.Items.Count];
  MainMenuStrip.Items.CopyTo(Copy, 0);
  SetVisibility(MainMenuStrip.Items);
  }
//

void NewUser_Click(object sender, EventArgs e) {
    MainMenuStrip.Items.Clear();
    MainMenuStrip.Items.AddRange(Copy);
    // create copy again for next user
    Copy = new ToolStripItem[MainMenuStrip.Items.Count];
    MainMenuStrip.Items.CopyTo(Copy, 0);
    SetVisibility(MainMenuStrip.Items);
   }
//
void SetVisibility(ToolStripItemCollection items)
        {
            foreach (ToolStripItem item in new IsolatorCollection(items))
            {
                if (item.Tag != null)
                    if ( CurrentUserShoundNotSeeThis(item.Tag))
                        items.Remove(item);
                // enumerate sub-items (if could have them)
                ToolStripDropDownItem dropItem = item as ToolStripDropDownItem;
                if (dropItem != null)
                    SetVisibility(dropItem.DropDownItems);
            }
        }


Andrus

GeneralRe: How to disable scroll in menu on visibility change Pin
AndrusM23-Jul-08 4:37
AndrusM23-Jul-08 4:37 
Questiondropdownlist problem Pin
scottichrosaviakosmos22-Jul-08 8:09
scottichrosaviakosmos22-Jul-08 8:09 
AnswerRe: dropdownlist problem Pin
carbon_golem22-Jul-08 8:51
carbon_golem22-Jul-08 8:51 
AnswerRe: dropdownlist problem Pin
Shuaib wasif khan22-Jul-08 9:15
Shuaib wasif khan22-Jul-08 9:15 
Questionmodifying start menu Pin
teejayem22-Jul-08 7:40
teejayem22-Jul-08 7:40 
AnswerRe: modifying start menu Pin
half-life22-Jul-08 8:00
half-life22-Jul-08 8:00 
GeneralRe: modifying start menu Pin
teejayem22-Jul-08 8:14
teejayem22-Jul-08 8:14 
AnswerRe: modifying start menu Pin
Luc Pattyn22-Jul-08 8:09
sitebuilderLuc Pattyn22-Jul-08 8:09 
GeneralRe: modifying start menu Pin
teejayem22-Jul-08 8:17
teejayem22-Jul-08 8:17 
AnswerRe: modifying start menu Pin
PIEBALDconsult22-Jul-08 8:25
mvePIEBALDconsult22-Jul-08 8:25 
GeneralRe: modifying start menu Pin
Luc Pattyn22-Jul-08 8:33
sitebuilderLuc Pattyn22-Jul-08 8:33 
GeneralRe: modifying start menu Pin
teejayem22-Jul-08 8:39
teejayem22-Jul-08 8:39 
GeneralRe: modifying start menu Pin
PIEBALDconsult22-Jul-08 9:03
mvePIEBALDconsult22-Jul-08 9:03 
AnswerRe: modifying start menu Pin
Luc Pattyn22-Jul-08 8:38
sitebuilderLuc Pattyn22-Jul-08 8:38 
GeneralRe: modifying start menu Pin
teejayem22-Jul-08 10:08
teejayem22-Jul-08 10:08 
GeneralRe: modifying start menu Pin
Luc Pattyn22-Jul-08 10:22
sitebuilderLuc Pattyn22-Jul-08 10:22 
AnswerRe: modifying start menu Pin
DaveyM6922-Jul-08 8:50
professionalDaveyM6922-Jul-08 8:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.