Hi everyone,
I am trying to find a way to highlight the active button appearance on my winform.Here I have a simple Text Editor with a richTextBox and a btnBold button located at ToolStrip which can change the font Style to be bold or not.Now I want to change the appearance of the btnBold if already clicked and release it to normal when it clicked again then user will be notice that if the btnBold, btnUnderline, and btnItalic has been set or not?

I really appreciate your time about this

Thanks Steve,
However,as I mentioned already I am using the btnBold button located at ToolStrip as standard style of all text editors style.
using the method which you offered from the MSDN library as:

ControlPaint.DrawButton(System.Drawing.Graphics.FromHwnd(toolStripButton1.Handle), 0, 0, toolStripButton1.Width, toolStripButton1.Height,ButtonState.Pushed);

generates an error as:
Error 1 'System.Windows.Forms.ToolStripButton' does not contain a definition for 'Handle' and no extension method 'Handle' accepting a first argument of type 'System.Windows.Forms.ToolStripButton' could be found (are you missing a using directive or an assembly reference?)

Can you please let me know how I can fix this?Is there any other method for example we can force the btnBold to keep Highlithed until next click?

Thanks

Edited 4 Years Ago by Behseini: n/a

on click of btn bold make btn font style bold

private void btnbold_Click(object sender, EventArgs e)
        {
            if (btnbold.Checked)
            {
                btnbold.Checked = false;
                btnbold.CheckState = CheckState.Unchecked;
                btnbold.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular);
            }
            else {
                btnbold.Checked = true;
                btnbold.CheckState = CheckState.Checked;
                btnbold.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
            }
        }
Comments
Perfect solution

Hi pritesh2010,
Thanks for your perfect solution.This is exactly what I was looking for.

This question has already been answered. Start a new discussion instead.