Exemplo n.º 1
0
 protected override void InitControl()
 {
     base.InitControl();
     EnableDoubleBuffer = false;
     Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
     BackColor = Color.Black;
     ForeColor = Color.White;
     rows = new ButtonGroup[]
     {
         new ButtonGroup(),
         new ButtonGroup(),
         new ButtonGroup(),
         new ButtonGroup(),
     };
     int index = 0;
     int buttonIndex = 0;
     foreach (ButtonGroup row in rows)
     {
         RoundedCorners corners;
         switch (index++)
         {
             case 0: corners = RoundedCorners.Top; break;
             case 3: corners = RoundedCorners.Bottom; break;
             default: corners = RoundedCorners.None; break;
         }
         row.Anchor = AnchorStyles.None;
         row.ButtonWidth = ScaleX(54);
         //row.Buttons.RaiseListChangedEvents = false;
         for (int i = 0; i < 4; i++)
         {
             row.Corners = corners;
             FluidButton btn = new FlatButton(labels[buttonIndex]);
             btn.Tag = buttonIndex;
             btn.Command = i.ToString();
             buttons[buttonIndex] = btn;
             if (i != 3) btn.PaintButtonText += new EventHandler<FluidPaintEventArgs>(btn_PaintButtonText);
             btn.Click += new EventHandler(btn_Click);
             // btn.ForeColor = ForeColor;
             switch (buttonIndex)
             {
                 //case 3: btn.BackColor = Color.FromArgb(48, 0, 0); break;
                 case 15: btn.BackColor = Color.FromArgb(0, 40, 0); break;
                 default: btn.BackColor = BackColor; break;
             }
             row.Buttons.Add(btn);
             buttonIndex++;
         }
         //row.Buttons.RaiseListChangedEvents = true;
         //row.Render();
         controls.Add(row);
     }
     Layout();
 }