/// <summary>
        /// Set a Loop Box item in Winform Menu
        /// </summary>
        /// <param name="menu"></param>
        /// <param name="component"></param>
        /// <param name="itemName">item's name for set infront of the name.</param>
        /// <param name="enable"></param>
        /// <param name="NameList"></param>
        /// <param name="IconList"></param>
        /// <param name="defaultIndex"></param>
        /// <param name="valueName"></param>
        public static void AddLoopBoexItem(ToolStripDropDown menu, LanguagableComponent component, string itemName, bool enable,
                                           string[] NameList, int defaultIndex, string valueName, Bitmap[] IconList = null)
        {
            if (defaultIndex > NameList.Length - 1)
            {
                throw new ArgumentOutOfRangeException("defaultIndex");
            }
            if (IconList != null && IconList.Length != NameList.Length)
            {
                throw new ArgumentOutOfRangeException("IconList");
            }

            int index = component.GetValuePub(valueName, defaultIndex);
            ToolStripMenuItem item = new ToolStripMenuItem(itemName + LanguagableComponent.GetTransLation(new string[] { ": ", ":" }) + NameList[index]);

            item.ToolTipText = LanguagableComponent.GetTransLation(new string[] { "Click to switch to ", "单击以切换到" }) +
                               NameList[(index + 1) % NameList.Length];

            if (IconList != null)
            {
                item.Image = IconList[index];
            }
            item.Enabled = enable;

            item.Click += Item_Click;
            void Item_Click(object sender, EventArgs e)
            {
                component.SetValuePub(valueName, (index + 1) % NameList.Length);
                component.ExpireSolution(true);
            }

            menu.Items.Add(item);
        }
        public static void AddColorBoxItem(ToolStripDropDown menu, LanguagableComponent component, string itemName, string itemTip, Bitmap itemIcon, bool enable,
                                           Color @default, string valueName)
        {
            bool flag = true;
            ToolStripMenuItem item = CreateOneItem(itemName, itemTip, itemIcon, enable);

            GH_DocumentObject.Menu_AppendColourPicker(item.DropDown, component.GetValuePub(valueName, @default), textcolorChange);
            void textcolorChange(GH_ColourPicker sender, GH_ColourPickerEventArgs e)
            {
                component.SetValuePub(valueName, e.Colour, flag);
                component.ExpireSolution(true);
                flag = false;
            }

            GH_DocumentObject.Menu_AppendItem(item.DropDown, LanguagableComponent.GetTransLation(new string[] { "Reset Color", "重置颜色" }), resetClick, Properties.Resources.ResetLogo,
                                              true, false).ToolTipText = LanguagableComponent.GetTransLation(new string[] { "Click to reset colors.", "点击以重置颜色。" });
            void resetClick(object sender, EventArgs e)
            {
                component.SetValuePub(valueName, @default);
                component.ExpireSolution(true);
            }

            menu.Items.Add(item);
        }
        public static void AddComboBoxItemMulty(ToolStripDropDown menu, LanguagableComponent component, ItemSet <bool> set)
        {
            GH_DocumentObject.Menu_AppendItem(menu, set.itemName, click, set.itemIcon, set.enable, component.GetValuePub(set.valueName, set.Default)).ToolTipText = set.itemTip;

            void click(object sender, EventArgs e)
            {
                component.SetValuePub(set.valueName, true);
            }
        }
        public static void AddComboBoxItemSingle(ToolStripDropDown menu, LanguagableComponent component, ItemSet <bool> set, string valueName, int index)
        {
            GH_DocumentObject.Menu_AppendItem(menu, set.itemName, click, set.itemIcon, set.enable, component.GetValuePub(valueName, 0) == index).ToolTipText = set.itemTip;

            void click(object sender, EventArgs e)
            {
                component.SetValuePub(valueName, index);
            }
        }