private void UpdateButton(bool recreate, bool updateText, bool updatePushedState) {
// It looks like ToolBarButtons with a DropDownButton tend to
// lose the DropDownButton very easily - so we need to recreate
// the button each time it changes just to be sure.
//
if (style == ToolBarButtonStyle.DropDownButton && parent != null && parent.DropDownArrows) {
recreate = true;
}
// we just need to get the Pushed state : this asks the Button its states and sets
// the private member "pushed" to right value..
// this member is used in "InternalSetButton" which calls GetTBBUTTONINFO(bool updateText)
// the GetButtonInfo method uses the "pushed" variable..
//rather than setting it ourselves .... we asks the button to set it for us..
if (updatePushedState && parent != null && parent.IsHandleCreated) {
GetPushedState();
}
if (parent != null) {
int index = FindButtonIndex();
if (index != -1)
parent.InternalSetButton(index, this, recreate, updateText);
}
}
}