c# - .NET Form Design - Button Group "Photoshop Tool Style" -


If you have ever used an image editing application, you will know that to select the existing tool There is a group of buttons. A device should be selected at all times, and when the device is selected, the button keeps pressing until a different tool is selected.

I controlled ToolStrip and set my images in the ToolStripButton objects, and for each button I checkon click The property is set to the right.

I subscribe to checked events on every button, and set another button checkstate to uncheck what I was going to do next Sounds like a kind of hack.

Is there a way to accomplish this with the tooltrip control, or is there a better control to use it?

I have C # and VS 2010, which targets Network 4

I think That's there

However, it can be semi-automated:

Call the SetToolButtonsChecked (sender) in each of your click events. ; Private Zero ToolstripButton1_click (Object Sender, EventEurge E) {Settlebuttons Checker (Sender); }

is implemented as:

  Private Static Zero SetToolButtonsChecked (Object Sender) {ToolStripButton btn = Sender as ToolStripButton; ToolStrip Strip = BTN Gatecontent (); Frontgroup (toolstreet item items in stripe). If (if the tool toolstrip button) is going to continue; ToolStripButton btnTemp = ToolStripButton as the object; if (! BtnTemp.CheckOnClick) will continue; BtnTemp.Checked = btnTemp.Equals (BTN);}}   

This method repeats all the buttons on the same toolstrip and sets the checked properties accordingly, if the button has the property CheckOnClick = true . < / Div>

Comments