Esempio n. 1
0
    private void AddRibbonSprite(RibbonInfo rib)
    {
        var name = rib.Name;
        var pb   = new PictureBox {
            AutoSize = false, Size = new Size(40, 40), BackgroundImageLayout = ImageLayout.Center, Visible = false, Name = PrefixPB + name
        };
        var img = RibbonSpriteUtil.GetRibbonSprite(name);

        pb.BackgroundImage = img;

        var display = RibbonStrings.GetName(name);

        pb.MouseEnter += (s, e) => tipName.SetToolTip(pb, display);
        FLP_Ribbons.Controls.Add(pb);
    }
Esempio n. 2
0
    private void AddRibbonNumericUpDown(RibbonInfo rib, int row)
    {
        var nud = new NumericUpDown
        {
            Anchor    = AnchorStyles.Right,
            Name      = PrefixNUD + rib.Name,
            Minimum   = 0,
            Width     = 35,
            Increment = 1,
            Padding   = Padding.Empty,
            Margin    = Padding.Empty,
            Maximum   = rib.MaxCount,
        };

        nud.ValueChanged += (sender, e) =>
        {
            FLP_Ribbons.Controls[PrefixPB + rib.Name].Visible         = (rib.RibbonCount = (int)nud.Value) > 0;
            FLP_Ribbons.Controls[PrefixPB + rib.Name].BackgroundImage = RibbonSpriteUtil.GetRibbonSprite(rib.Name, (int)nud.Maximum, (int)nud.Value);
        };
        nud.Value = rib.RibbonCount > nud.Maximum ? nud.Maximum : rib.RibbonCount;
        TLP_Ribbons.Controls.Add(nud, 0, row);
    }