Пример #1
0
        private void InitializeComponent()
        {
            this.SuspendLayout();

            this.index.UpDownAlign   = LeftRightAlignment.Left;
            this.index.TextAlign     = HorizontalAlignment.Right;
            this.index.Size          = new Size(50, 20);
            this.index.Location      = new Point(0, 0);
            this.index.Minimum       = (Decimal)(0);
            this.index.Maximum       = (Decimal)(Int32.MaxValue);
            this.index.ValueChanged += new EventHandler(delegate { PopulateControl(); });
            MenuItem na_empty = new MenuItem("Empty Array", new EventHandler(EmptyArray));

            this.index.ContextMenu = new ContextMenu();
            this.index.ContextMenu.MenuItems.Add(na_empty);
            this.Controls.Add(index);

            TemplateElement                = NumericBox();
            TemplateElement.Width          = 50;
            TemplateElement.SpinBoxVisible = false;
            elements[0]          = NumericBox();
            elements[0].Location = new Point(index.Width + 1, 0);
            CloneElement(elements[0]);
            elements[0].ValueChanged += new EventHandler(NumericArray_ValueChanged);
            this.Controls.Add(elements[0]);
            PopulateControl();

            this.ResumeLayout(true);
        }
Пример #2
0
 /// <summary>
 /// Sets some properties to be equal to those of TemplateElement
 /// </summary>
 /// <param name="new_element">Control to be modified</param>
 private void CloneElement(NumericBox <T> new_element)
 {
     new_element.Size             = TemplateElement.Size;
     new_element.SpinBoxVisible   = TemplateElement.SpinBoxVisible;
     new_element.SpinBoxAlignment = TemplateElement.SpinBoxAlignment;
     new_element.IsIndicator      = TemplateElement.IsIndicator;
     new_element.BackColor        = TemplateElement.BackColor;
     new_element.ForeColor        = TemplateElement.ForeColor;
     new_element.MinValue         = TemplateElement.MinValue;
     new_element.MaxValue         = TemplateElement.MaxValue;
     new_element.Increment        = TemplateElement.Increment;
     new_element.StrictIncrement  = TemplateElement.StrictIncrement;
     new_element.Format           = TemplateElement.Format;
 }