public void DrawComboxDropDown(Graphics g, RibbonComboBox b, Ribbon ribbon)
        {
            if (b.DropDownButtonPressed)
            {
                DrawButtonPressed(g, b.DropDownButtonBounds, Corners.None, ribbon);
            }
            else if (b.DropDownButtonSelected)
            {
                DrawButtonSelected(g, b.DropDownButtonBounds, Corners.None, ribbon);
            }
            else if (b.Selected)
            {
                DrawButton(g, b.DropDownButtonBounds, Corners.None);
            }

            DrawArrowShaded(g, b.DropDownButtonBounds, RibbonArrowDirection.Down, true);//b.Enabled);
        }
예제 #2
0
        private void BuildDropDownMenu()
        {
            cobDownloaders.DropDownItems.Clear();

            List<RibbonComboBox> languages = new List<RibbonComboBox>();

            foreach (var downloader in Downloader.GetAllDownloaders())
            {
                var attributes = downloader.GetType().GetCustomAttributes(typeof(DownloaderAttribute), true);
                if (attributes != null)
                {
                    foreach (DownloaderAttribute att in attributes)
                    {
                        var tag = languages.Find(p => p.Tag!=null && p.Tag.ToString() == att.Language);
                        if (tag == null)
                        {
                            tag = new RibbonComboBox()
                            {
                                Text = att.Language,
                                Value = att.Language,
                                Tag = att.Language,
                                TextBoxText= att.Language
                            };
                            languages.Add(tag);
                        }
                        RibbonButton downloaderMenuButton = new RibbonButton()
                        {
                            MaximumSize = new System.Drawing.Size(0, 0),
                            MinimumSize = new System.Drawing.Size(0, 0),
                            Text = downloader.Name,
                            Tag = downloader
                        };
                        downloaderMenuButton.Click += new EventHandler(delegate(object sender, EventArgs e)
                        {
                            var dl = ((RibbonButton)sender).Tag as Downloader;

                            AddChildForm(dl.Name, dl);
                        });

                        tag.DropDownItems.Add(downloaderMenuButton);
                    }
                }
            }
            foreach (var item in languages)
            {
                cobDownloaders.DropDownItems.Add(item);



            }
        }