/// <summary> /// 设置工具栏按钮的界面元素值 /// </summary> /// <param name="Tsb"></param> /// <param name="UIE"></param> protected void SetToolStripComboBoxValue(object ControlObj, IUIElement UIE) { ToolStripComboBox Tsb = (ToolStripComboBox)ControlObj; if (UIE != null) { Tsb.Visible = UIE.IsVisible(); Tsb.Enabled = UIE.IsEnabled(); } int selectindex = -1; foreach (object obj in Tsb.Items) { IToolsItem tt = obj as IToolsItem; if (tt != null) { if (tt.UIElement != null) { if (tt.UIElement.IsActive()) { selectindex = Tsb.Items.IndexOf(obj); } } } } if (selectindex != -1 && Tsb.DroppedDown == false) { Tsb.SelectedIndex = selectindex; } }
/// <summary> /// 设置工具栏按钮的界面元素值 /// </summary> /// <param name="Tsb"></param> /// <param name="UIE"></param> protected void SetToolStripButtonValue(object ControlObj, IUIElement UIE) { ToolStripButton Tsb = (ToolStripButton)ControlObj; Tsb.Visible = UIE.IsVisible(); Tsb.Enabled = UIE.IsEnabled(); Tsb.Checked = UIE.IsActive(); }