Button color problem

May 9, 2011 at 7:40 PM

I've just started to use Fluid and have a problem: button background color doesn't change after clicking on it (click event is registered). Code is below.

In main form class:

            fluidHost.Bounds = fluidHost.ClientBounds;
            fluidHost.BackColor = Color.Empty;

            new SettingsPanel().ShowMaximized();

In SettingsPanel class constructor:

            base.InitControl();
            Bounds = new Rectangle(0, 0, 480, 800);
            BackColor = Color.LightSteelBlue;
            GradientFill = true;
            GradientFillOffset = 30;
            ForeColor = Color.White;

            Controls.Add(new FluidLabel("Size:", 30, 60, 480, 40)
            {
                ShadowColor = Color.Black,
                ForeColor = Color.White,
                Alignment = StringAlignment.Center,
                LineAlignment = StringAlignment.Center,
                Font = new Font(FontFamily.GenericSansSerif, 12f, FontStyle.Bold),
                Anchor = AnchorTLR
            });

            sizeGroup = new ButtonGroup(30, 120, 480 - 2 * 30, 40);
            for (int i = 4; i <= 8; i++)
            {
                FluidButton btn = new FluidButton(i.ToString(), (i == 5 ? Color.BlueViolet : Color.YellowGreen));
                btn.Click += new EventHandler(SizeButton_Click);

                sizeGroup.Add(btn);
            }
            Controls.Add(sizeGroup);

And in SizeButton_Click:

        void SizeButton_Click(object sender, EventArgs e)
        {
            foreach (var btn in sizeGroup.Buttons)
            {
                btn.BackColor = Color.YellowGreen;
            }
            (sender as FluidButton).BackColor = Color.BlueViolet;
        }

Color doesn't change after clicking as expected. What should I change to have this working?