protected void OnBeforeQueryStatus(object sender, EventArgs e) { OleMenuCommand command = sender as OleMenuCommand; command.Enabled = command.Supported = CanExecute(command); }