Exemple #1
0
        RibbonGroup CreateParagraphGroup()
        {
            RibbonGroup g = new RibbonGroup();

            g.Text = g.ID = "Paragraph";
            g.HasLauncherButton = true;

            RibbonToolBar tb = new RibbonToolBar();

            g.Items.Add(tb);

            RibbonToggleGroup tg = new RibbonToggleGroup();

            tg.Items.Add(CreateToggleButton("Bullets"));
            tg.Items.Add(CreateToggleButton("Numbering"));
            tb.Items.Add(tg);

            tb.Items.Add(new RibbonSeparator());
            tb.Items.Add(CreateButton("DecreaseIndent"));
            tb.Items.Add(CreateButton("IncreaseIndent"));

            tb.Items.Add(new RibbonSeparator());
            tb.Items.Add(CreateMenu("LineSpacing",
                                    "1.0", "1.15", "1.5", "2.0", "2.5", "3.0"));

            tb = new RibbonToolBar();
            g.Items.Add(tb);

            tg = new RibbonToggleGroup();
            tg.Items.Add(CreateToggleButton("AlignLeft"));
            tg.Items.Add(CreateToggleButton("Center"));
            tg.Items.Add(CreateToggleButton("AlignRight"));
            tg.Items.Add(CreateToggleButton("Justify"));
            tb.Items.Add(tg);

            tb.Items.Add(new RibbonSeparator());
            RibbonColorPicker cp = new RibbonColorPicker();

            SetItemProperties(cp, "BackgroundColor");
            cp.Color = System.Drawing.Color.Yellow;
            tb.Items.Add(cp);

            return(g);
        }
Exemple #2
0
        RibbonGroup CreateFontGroup()
        {
            RibbonGroup g = new RibbonGroup();

            g.Text = g.ID = "Font";
            g.HasLauncherButton = true;

            RibbonToolBar tb = new RibbonToolBar();

            g.Items.Add(tb);
            RibbonComboBox cmb = new RibbonComboBox();

            SetItemProperties(cmb, "FontFace");
            cmb.TextAreaWidth = 120;
            foreach (FontFamily fontFamily in FontFamily.Families)
            {
                cmb.Items.Add(new RibbonButton(fontFamily.Name));
            }
            tb.Items.Add(cmb);

            cmb = new RibbonComboBox();
            SetItemProperties(cmb, "FontSize");
            cmb.TextAreaWidth = 30;
            foreach (int size in new int[] { 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 })
            {
                cmb.Items.Add(new RibbonButton(size.ToString()));
            }
            tb.Items.Add(cmb);

            tb.Items.Add(new RibbonSeparator());
            tb.Items.Add(CreateToggleButton("IncreaseFontSize"));
            tb.Items.Add(CreateToggleButton("DecreaseFontSize"));

            tb.Items.Add(new RibbonSeparator());
            tb.Items.Add(CreateButton("ClearFormatting"));

            tb = new RibbonToolBar();
            g.Items.Add(tb);
            tb.Items.Add(CreateToggleButton("Bold"));
            tb.Items.Add(CreateToggleButton("Italic"));
            tb.Items.Add(CreateToggleButton("Underline"));
            tb.Items.Add(CreateToggleButton("Strikethrough"));
            tb.Items.Add(CreateToggleButton("Subscript"));
            tb.Items.Add(CreateToggleButton("Superscript"));
            tb.Items.Add(CreateMenu("ChangeCase",
                                    CreateButton("LowerCase"),
                                    CreateButton("UpperCase"),
                                    CreateButton("CapitalizeCase")));

            tb.Items.Add(new RibbonSeparator());

            RibbonColorPicker cp = new RibbonColorPicker();

            SetItemProperties(cp, "HighlightColor");
            cp.Color = System.Drawing.Color.Yellow;
            tb.Items.Add(cp);

            cp = new RibbonColorPicker();
            SetItemProperties(cp, "FontColor");
            cp.Color = System.Drawing.Color.Red;
            tb.Items.Add(cp);

            return(g);
        }