private void DefineToggleButton(IToolBarComponent comp, IToolBarToggleButton element) { ToolStripButton tb = new ToolStripButton(); tb.Image = element.Icon; ToggleButtonTag tag = new ToggleButtonTag(GetCommandTarget(), comp, element); tb.Tag = tag; tb.Click += new EventHandler(tag.OnClick); if (!RuntimeUtil.IsZeroLength(element.ToolTipText)) { tb.ToolTipText = element.ToolTipText; } _currentToolStrip.Items.Add(tb); }
private void DefineComboBox(IToolBarComponent comp, IToolBarComboBox element) { ToolStripComboBox cb = new ToolStripComboBox(); cb.Items.AddRange(element.Items); cb.Size = new Size(element.Width, cb.Height); //Widthを直接設定してもいかんらしい。なんじゃいな cb.DropDownStyle = ComboBoxStyle.DropDownList; ComboBoxTag tag = new ComboBoxTag(GetCommandTarget(), comp, element); cb.Tag = tag; cb.SelectedIndexChanged += new EventHandler(tag.OnSelectedIndexChanged); if (!RuntimeUtil.IsZeroLength(element.ToolTipText)) { cb.ToolTipText = element.ToolTipText; } _currentToolStrip.Items.Add(cb); }