/// <summary> /// Create a new instance of the <see cref="IntBoxController"/> class initializing /// the object state /// </summary> /// <param name="element">The element representig the related <see cref="IntBox"/></param> /// <param name="enabled">A boolean value, textbox is editable if true, disabled otherwise</param> public IntBoxController(IntBox element, bool enabled) : base(enabled) { this.element = element; textbox = new TextBox(); textbox.Text = element.Value == null ? "" : element.Value.ToString(); textbox.Dock = DockStyle.None; textbox.Font = new Font("Tahoma", 8, FontStyle.Regular); //Events textbox.GotFocus += OnGotFocus; textbox.LostFocus += OnLostFocus; // Enable/disable control's textbox according to the "enable" variable value textbox.Enabled = enabled; if (!textbox.Enabled) { textbox.Text = element.Value.ToString(); } Content = textbox; Title = element.Name; Description = element.Description; }
/// <summary> /// Implements the Sum operation between two <see cref="IntBox"/> returning the /// sum of the two elements as an <see cref="IntBox"/> /// </summary> /// <param name="par1">The first element to sum</param> /// <param name="par2">The second one</param> public static IntBox Sum(IntBox par1, IntBox par2) { IntBox element = new IntBox("IntBox", "IntBox", null); element.Value = par1.Value + par2.Value; return(element); }
/// <summary> /// Returns the length of the node value. /// </summary> /// <param name="node1">The first value</param> /// <param name="node2">The second value</param> /// <returns>The sum of the length of the nodes value.</returns> public static IntBox Length(StringBox par) { IntBox element = new IntBox("IntBox", "IntBox", null); element.Value = par.Value.Length; return(element); }
/// <summary> /// Implements the Less operation between two <see cref="IntBox"/> returning true /// if the second element Value is greater than the second, false otherwise /// </summary> /// <param name="par1">The first element to analize</param> /// <param name="par2">The second one</param> public static bool Less(IntBox par1, IntBox par2) { return(par1.Value < par2.Value); }
/// <summary> /// Implements the Greater operation between two <see cref="IntBox"/> returning true /// if the first element is greater than the second, false otherwise /// </summary> /// <param name="par1">The first element to analize</param> /// <param name="par2">The second one</param> public static bool Greater(IntBox par1, IntBox par2) { return(par1.Value > par2.Value); }
/// <summary> /// Implements the Equal operation between two <see cref="Intbox"/> returning true /// if the elements have the same value, false otherwise /// </summary> /// <param name="par1">The first element to analize</param> /// <param name="par2">The second one</param> /// <returns></returns> public static bool Equal(IntBox par1, IntBox par2) { return(par1.Value == par2.Value); }
///<summary> /// Create a new instance of the <see cref="BoolBoxController"/> class initializing /// the object state /// </summary> /// <param name="element">The element representig the related <see cref="IntBox"/></param> public IntBoxController(IntBox element) : this(element, true) { }