示例#1
0
        private void InitRules()
        {
            _rulesManager.SetC1RulesManager(_flexGrid, _rulesManager);
            var rulesDict = new Dictionary <string, string>()
            {
                { "Discount < 10%", "= [Discount] < 0.1" },
                { "Discount < 20%", "= [Discount] < 0.2" },
                { "Discount < 30%", "= [Discount] < 0.3" }
            };

            // creating rules
            _rules = rulesDict.Keys
                     .Select(x => new C1.Win.RulesManager.Rule()
            {
                Name       = x,
                Expression = rulesDict[x],
                Style      = new ItemStyle()
                {
                    ForeColor   = Color.FromArgb(s_rnd.Next(255), s_rnd.Next(255), s_rnd.Next(255)),
                    BorderColor = Color.DarkBlue,
                    FontStyle   = FontStyle.Bold
                }
            });

            // add menu items
            IEnumerable <RibbonToggleButton> ruleRibbonToggleButtons = rulesDict.Keys
                                                                       .Select(x => new RibbonToggleButton()
            {
                Text    = x,
                Pressed = false
            });

            foreach (RibbonToggleButton ruleRibbonToggleButton in ruleRibbonToggleButtons)
            {
                ruleRibbonToggleButton.PressedButtonChanged += RuleRibbonToggleButton_PressedButtonChanged;
                _ribbonMenuFormatting.Items.Add(ruleRibbonToggleButton);
            }
        }
示例#2
0
        private void InitRules()
        {
            _rulesManager.SetC1RulesManager(_flex, _rulesManager);
            var rulesDict = new Dictionary <string, string>()
            {
                { "Discount < 10%", "= [Discount] < 0.1" },
                { "Discount < 20%", "= [Discount] < 0.2" },
                { "Discount < 30%", "= [Discount] < 0.3" }
            };

            // Creating rules
            _rules = rulesDict.Keys
                     .Select(x => new C1.Win.RulesManager.Rule()
            {
                Name       = x,
                Expression = rulesDict[x],
                Style      = new ItemStyle()
                {
                    ForeColor   = Color.FromArgb(_rnd.Next(255), _rnd.Next(255), _rnd.Next(255)),
                    BorderColor = Color.DarkBlue,
                    FontStyle   = FontStyle.Bold
                }
            });

            // Add menu items
            rulesDict.Keys
            .Select(x => new RibbonToggleButton()
            {
                Text    = x,
                Pressed = false
            })
            .ToList()
            .ForEach(x =>
            {
                x.PressedButtonChanged += new EventHandler(_lstFormating_PressedChanged);
                _lstFormating.Items.Add(x);
            });
        }