You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Mesnac.Controls.Default
{
public partial class MCToolBar : ToolStrip
{
private System.Windows.Forms.ToolStripDropDownButton DropDownButton;
public MCToolBar()
{
InitializeComponent();
this.GripStyle = ToolStripGripStyle.Hidden;
base.PaintGrip += new PaintEventHandler(MCToolBar_PaintGrip);
}
void MCToolBar_Click(object sender, EventArgs e)
{
MessageBox.Show("ss");
}
public MCToolBar(IContainer container)
{
container.Add(this);
InitializeComponent();
base.PaintGrip += new PaintEventHandler(MCToolBar_PaintGrip);
}
void MCToolBar_PaintGrip(object sender, PaintEventArgs e)
{
return;
}
protected override ToolStripItemCollection DisplayedItems
{
get
{
//if (base.DesignMode)
//{
base.DisplayedItems.Clear();
return base.DisplayedItems;
//}
//this.DropDownButton = new System.Windows.Forms.ToolStripDropDownButton();
//this.Click += new EventHandler(MCToolBar_Click);
//base.DisplayedItems.Add(DropDownButton);
//ToolStripPanel dropDown = new ToolStripPanel();
//dropDown.Opening += new CancelEventHandler(DropDown_Opening);
//this.DropDownButton.DropDown = dropDown;
//return base.DisplayedItems;
}
}
List<CustomDropDownItem> _dropDownItems = new List<CustomDropDownItem>();
public List<CustomDropDownItem> DropDownItems
{
get { return _dropDownItems; }
set
{
_dropDownItems = value;
if (value == null)
return;
//foreach (CustomDropDownItem item in (List<CustomDropDownItem>)_dropDownItems)
//{
// switch (item.Itemtype)
// {
// case itemtype.MCToolStripButton:
// MCToolStripButton mcsb = new MCToolStripButton();
// mcsb.Name = item.Name;
// bool isf = false;
// foreach (ToolStripItem itm in this.Items)
// {
// if (itm.Name == item.Name)
// {
// isf = true;
// }
// }
// if (!isf)
// this.Items.Add(mcsb);
// break;
// default:
// break;
// }
//}
}
}
void DropDown_Opening(object sender, CancelEventArgs e)
{
//ToolStripPanel c = (ToolStripPanel)this.DropDownButton.DropDown;
}
}
[Serializable]
public class CustomDropDownItem
{
private itemtype itemtype;
public itemtype Itemtype
{
get { return itemtype; }
set { itemtype = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
}
public enum itemtype
{
MCToolStripButton,
}
}