Exemplo n.º 1
0
 public NumberRegRuleItem(RegRule rule, ItemInfo info) : base(info)
 {
     this.AddCtr(NudValue);
     ToolTipBox.SetToolTip(NudValue, info.Tip);
     TsiRegLocation = new RegLocationMenuItem(this);
     this.ContextMenuStrip.Items.AddRange(new ToolStripItem[] { new ToolStripSeparator(), TsiRegLocation });
     this.Rule              = rule;
     NudValue.Maximum       = rule.MaxValue;
     NudValue.Minimum       = rule.MinValue;
     NudValue.Font          = new Font(this.Font.FontFamily, this.Font.Size + 3F);
     NudValue.ValueChanged += (sender, e) =>
     {
         if (NudValue.Value == Rule.DefaultValue)
         {
             NudValue.ForeColor = Color.FromArgb(0, 138, 217);
             NudValue.Font      = new Font(NudValue.Font, FontStyle.Bold);
         }
         else
         {
             NudValue.ForeColor = Color.Black;
             NudValue.Font      = new Font(NudValue.Font, FontStyle.Regular);
         }
         this.ItemValue = (int)NudValue.Value;
     };
     NudValue.Value = ItemValue;
 }
Exemplo n.º 2
0
 public StringRegRuleItem(RegRule rule, ItemInfo info) : base(info)
 {
     this.AddCtr(LblValue);
     ToolTipBox.SetToolTip(LblValue, info.Tip);
     TsiRegLocation = new RegLocationMenuItem(this);
     this.ContextMenuStrip.Items.AddRange(new ToolStripItem[] { new ToolStripSeparator(), TsiRegLocation });
     this.Rule           = rule;
     LblValue.Text       = ItemValue;
     LblValue.Font       = new Font(this.Font.FontFamily, this.Font.Size + 3F);
     LblValue.MouseDown += (sender, e) =>
     {
         using (InputDialog dlg = new InputDialog())
         {
             dlg.Title = AppString.Menu.ChangeText;
             dlg.Text  = ItemValue;
             if (dlg.ShowDialog() != DialogResult.OK)
             {
                 return;
             }
             ItemValue = LblValue.Text = dlg.Text;
         }
     };
     LblValue.TextChanged += (sender, e) => ItemValue = LblValue.Text;
 }
Exemplo n.º 3
0
 public RegRuleItem(RegRule rule, ItemInfo info)
     : this(info) { this.Rules = new[] { rule }; }