public KeyConfirmationBox(string text, bool isColorBox = false)
        {
            IsColorBox = isColorBox;

            label           = new UILabel();
            label.Text      = text;
            label.TextAlign = ContentAlignment.MiddleLeft;
            label.Font      = new Font("Trebuchet MS", 9);

            field = new UITextField();

            Controls.Add(label);

            Controls.Add(field);

            BackColor = Color.FromArgb(210, 210, 210);

            if (IsColorBox)
            {
                chosenColor = new Subview();
                Controls.Add(chosenColor);

                colorBox = new ColorBox();
                Controls.Add(colorBox);
                colorBox.ColorClick += UpdateColor;
            }
        }
Пример #2
0
        public ColorBox()
        {
            color1           = new Subview();
            color1.BackColor = Color.Red;
            Controls.Add(color1);

            color2           = new Subview();
            color2.BackColor = Color.Green;
            Controls.Add(color2);

            color3           = new Subview();
            color3.BackColor = Color.Blue;
            Controls.Add(color3);

            color4           = new Subview();
            color4.BackColor = Color.Yellow;
            Controls.Add(color4);

            Cursor = System.Windows.Forms.Cursors.Hand;

            color1.Click += OnColorClicked;
            color2.Click += OnColorClicked;
            color3.Click += OnColorClicked;
            color4.Click += OnColorClicked;
        }
Пример #3
0
        private void OnColorClicked(object sender, EventArgs e)
        {
            Subview box = (Subview)sender;

            selected = box.BackColor.ToLampColor();

            ColorClick?.Invoke(sender, e);
        }
Пример #4
0
        public virtual void LayoutSubviews()
        {
            NeedsLayout = false;

            foreach (UIView Subview in Subviews)
            {
                Subview.LayoutSubviews();
            }
        }
Пример #5
0
 /// <summary>
 /// Draws the children of the panel with a ZOrder greater than 0.
 /// These views will be drawn above the border elements of this view.
 /// </summary>
 /// <param name="CurrentBatch"></param>
 /// <param name="BoundingBox">If the subview does not intersect this area, it won't be drawn.</param>
 protected virtual void DrawForegroundChildren(SpriteBatch CurrentBatch, Rectangle BoundingBox)
 {
     foreach (UIView Subview in Children)
     {
         if (Subview.ZOrder > 0)
         {
             Subview.Draw(CurrentBatch, BoundingBox);
         }
     }
 }
Пример #6
0
 public static Frame CenterEmptyInParent(Subview view)
 {
     return(new Frame(view.Frame.W / 2, view.Frame.H / 2, 0, 0));
 }