Esempio n. 1
0
 public override void Initialize(System.ComponentModel.IComponent component)
 {
     base.Initialize(component);
     if (component is NaviGroup)
     {
         m_designingControl = (NaviGroup)component;
     }
     InitializeServices();
 }
Esempio n. 2
0
        private void AddSnippetGroups()
        {
            List <string> categories = GetSnippetCategories();
            Dictionary <string, List <Snippet> > categorizedSnippets = GetSnippets();

            categories.Sort();
            categories.Reverse();

            foreach (String category in categories)
            {
                List <Snippet> snippets = categorizedSnippets[category];

                if (category == "Templates")
                {
                    LoadTemplates(snippets);
                    continue;
                }

                NaviGroup group = new NaviGroup(this.components);
                group.Caption = category;
                group.Dock    = DockStyle.Top;
                //group.Location = new Point(0, 0);
                group.LayoutStyle = NaviLayoutStyle.Office2007Black;
                group.Size        = new Size(100, 150);

                naviBand1.ClientArea.Controls.Add(group);

                List <Snippet> orderedSnippets = snippets.OrderByDescending(s => s.LongName).ToList();

                foreach (Snippet sn in orderedSnippets)
                {
                    Label l1 = new Label();

                    if (sn.LongName == "")
                    {
                        l1.Text = sn.Shortcut;
                    }
                    else
                    {
                        l1.Text = sn.LongName;
                    }

                    group.Controls.Add(l1);
                    l1.Dock = DockStyle.Top;

                    l1.ImageList = m_snippetImages;

                    if (sn.IconName == "")
                    {
                        l1.ImageIndex = m_snippetImages.Images.IndexOfKey("default.png");
                    }
                    else
                    {
                        l1.ImageIndex = m_snippetImages.Images.IndexOfKey(sn.IconName);
                    }

                    l1.ImageAlign = ContentAlignment.TopCenter;
                    l1.TextAlign  = ContentAlignment.BottomCenter;
                    l1.Height     = 50;
                    l1.BackColor  = Color.Transparent;
                    l1.Margin     = new System.Windows.Forms.Padding(4);

                    l1.MouseDown += new MouseEventHandler(l1_MouseDown);
                    l1.MouseMove += new MouseEventHandler(l1_MouseMove);
                    l1.MouseUp   += new MouseEventHandler(l1_MouseUp);

                    l1.Tag = sn;
                }

                int height = snippets.Count * 60;
                group.ExpandedHeight = height;
                group.Expand();
            }
        }