当前位置: 首页>>代码示例>>C#>>正文


C# ComboBox.AddItem方法代码示例

本文整理汇总了C#中ComboBox.AddItem方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.AddItem方法的具体用法?C# ComboBox.AddItem怎么用?C# ComboBox.AddItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ComboBox的用法示例。


在下文中一共展示了ComboBox.AddItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddThemeListTo

 /// <summary>
 /// Adds the list of themes to the specified combobox reference.
 /// </summary>
 /// <param name="comboBox"></param>
 public static void AddThemeListTo(ref ComboBox comboBox)
 {
     foreach (var theme in ThemeList)
     {
         comboBox.AddItem(theme.ToString(), ((int)theme).ToString());
     }
 }
开发者ID:omazlov,项目名称:Ext.NET.Examples,代码行数:11,代码来源:ThemeListHandler.cs

示例2: AddThemeListTo

 /// <summary>
 /// Adds the list of themes to the specified combobox reference.
 /// </summary>
 /// <param name="comboBox"></param>
 public static void AddThemeListTo(ref ComboBox comboBox)
 {
     foreach (var theme in ThemeList)
     {
         if (theme != Theme.Aria) // Aria theme is not supported for UI
         {
             comboBox.AddItem(theme.ToString(), ((int)theme).ToString());
         }
     }
 }
开发者ID:extnet,项目名称:Ext.NET.Examples,代码行数:14,代码来源:ThemeListHandler.cs

示例3: Start

 // Use this for initialization
 void Start()
 {
     cb = new ComboBox();
     style = new GUIStyle();
     foreach(Transform child in this.transform) {
         ComboBox.ComboItem childItem = new ComboBox.ComboItem(child.name, child);
         childItem.OnMarkedAction += SelectItem;
         childItem.OnUnMarkedAction += DeselectItem;
         cb.AddItem(childItem);
     }
 }
开发者ID:niguerrac,项目名称:UnityUI,代码行数:12,代码来源:ComboBoxTestInterface.cs

示例4: Initialize

        public override void Initialize()
        {
            base.Initialize();

            combo = new ComboBox();

            combo.AddItem("Fruit");
            combo.AddItem("Milk");
            combo.AddItem("Wine");
            combo.AddItem("Ice");
            combo.AddItem("Ice cream");
            combo.AddItem("Carrots");
            combo.AddItem("Potatoes");
            combo.AddItem("Ketchup");
            combo.AddItem("Tomatoes");

            AddComponent(combo, 10, 100);
        }
开发者ID:Syderis,项目名称:CellSDK-Tutorials,代码行数:18,代码来源:MainScreen.cs

示例5: Initialize

        public override void Initialize()
        {
            fnt = new Font("msyh.ttc", 25);
            fntsmall = new Font("msyh.ttc", 15);
            fntborder = new Font("msyh.ttc", 15)
            {
                EnableBorder = true,
                BorderColor = Color.Black
            };

            spm = new ScrollPanel()
            {
                Margin = Origins.TopRight,
                Width = 1000,
                Height = GraphicsDevice.Viewport.Height - 80,
                Top = 80,
                Right = 0
            };

            b = new Button()
            {
                Bottom = 10,
                Left = 195,
                Width = 165,
                Height = 40,
                Margin = Origins.BottomLeft,
            };

            breturn = new Button()
            {
                Bottom = 10,
                Left = 10,
                Width = 165,
                Height = 40,
                Margin = Origins.BottomLeft
            };

            combob = new ComboBox()
            {
                Top = 120,
                Left = 10,
                Width = 350,
                Margin = Origins.TopLeft,
            };

            groupcb = new ComboBox()
            {
                Top = 10,
                Right = 300,
                Width = 200,
                Margin = Origins.TopRight,
                FocusColor = Color.CornflowerBlue,
            };

            sortcb = new ComboBox()
            {
                Top = 10,
                Right = 20,
                Width = 200,
                Margin = Origins.TopRight,
                FocusColor = Color.LightGreen,
            };

            tb = new TabControl()
            {
                Top = 54,
                Right = 10,
                Margin = Origins.TopRight,
                Width = GraphicsDevice.Viewport.Width,
                Height = GraphicsDevice.Viewport.Height,
                TabMargin = Origins.TopRight
            };

            bg = Sprite.CreateTextureFromFile(@"Content\menu-background-xmas-6.png");
            menu_osu = Sprite.CreateTextureFromFile(@"Content\010c0951.png");
            top = Sprite.CreateTextureFromFile(@"Content\songselect-top.png");

            Controls.Add(spm);
            Controls.Add(b);
            Controls.Add(breturn);
            Controls.Add(tb);
            Controls.Add(combob);
            Controls.Add(groupcb);
            Controls.Add(sortcb);

            base.Initialize();

            CreateMap();
            p_Click((object)maps[0], null);

            spm.Controls.AddRange(maps.ToArray());

            spm.ScrollSpeed = 150;
            b.Text = "开始颓废";
            breturn.Text = "返回母港";
            breturn.Click += Breturn_Click;

            combob.AddItem("地图信息");
            combob.AddItem("本地排行");
            combob.AddItem("在线排行");
//.........这里部分代码省略.........
开发者ID:jxpxxzj,项目名称:WarshipGirl,代码行数:101,代码来源:MapSelect.cs

示例6: PropertyWindow

		public PropertyWindow(GuiManager guiMan, InputManager inpMan, GameData gameData,
			GuiData guiData) : base(GuiManager.cursor)
		{
			#region engine data and GUI object references
			PropertyWindowMessages.guiData = guiData;
			PropertyWindowMessages.gameData = gameData;
			PropertyWindowMessages.guiMan = guiMan;
			PropertyWindowMessages.sprMan = gameData.sprMan;
			PropertyWindowMessages.propWindow = this;

			#endregion 

			#region Initialize this and the WAVListBox
			sclX = 20;
			sclY = 20;
			SetPositionTL(20, 22.8f);
			mMoveBar = true;
			AddXButton();
			mName = "Properties";

			propertiesEditingListBox = this.AddWAVListBox(GuiManager.cursor);
			propertiesEditingListBox.sclX = 7;
			propertiesEditingListBox.sclY = 18.5f;
			propertiesEditingListBox.SetPositionTL(sclX-12.5f, sclY + -.1f);
			propertiesEditingListBox.scrollBarVisible = false;
				
			propertiesEditingListBox.onClick += new FrbGuiMessage(PropertyWindowMessages.propertiesEditingClick);
			GuiManager.AddWindow(this);
			#endregion			

			#region textureGUI

			textureGUI = new WindowArray();
            
            texturePath = AddTextDisplay();
			texturePath.text = "Click button to set texture";
            texturePath.SetPositionTL(propertiesEditingListBox.sclX * 2 + 1, 1.5f);
			textureGUI.Add(texturePath);



			textureOrAnimation = AddComboBox();
			textureOrAnimation.sclX = 7;
			textureOrAnimation.AddItem("Single Texture");
			textureOrAnimation.AddItem("Animation Chain");
			textureOrAnimation.text = "Single Texture";
            textureOrAnimation.SetPositionTL(propertiesEditingListBox.sclX * 2 + 8, 3.5f);
			textureOrAnimation.onItemClick += new FrbGuiMessage(PropertyWindowMessages.updateTextureOrAnimationButton);
			textureGUI.Add(textureOrAnimation);

			#region single texture GUI


			textureButton = AddButton();
			textureButton.sclX = textureButton.sclY = 9;
            textureButton.SetPositionTL(propertiesEditingListBox.sclX * 2 + 10, 14.0f);
			textureButton.onClick += new FrbGuiMessage(PropertyWindowMessages.textureButtonClick);
			textureGUI.Add(textureButton);
			#endregion


			textureGUI.visible = false;

			propertiesEditingListBox.AddWindowArray("Texture", textureGUI);

			#endregion

			#region particlePropertiesGUI
			particlePropertiesGUI = new WindowArray();

			float runningY = 4;

			emitterNameDisplay = this.AddTextDisplay();
			emitterNameDisplay.text = "Name:";
			emitterNameDisplay.SetPositionTL(15, runningY);
			particlePropertiesGUI.Add(emitterNameDisplay);

			emitterName = AddTextBox();
			emitterName.sclX = 5;
			emitterName.SetPositionTL(26, runningY);
			emitterName.onLosingFocus += new FrbGuiMessage(PropertyWindowMessages.emitterNameTextBoxLoseFocus);
			particlePropertiesGUI.Add(emitterName);

			runningY += 3;

			#region x y z position

			xPos = AddTextDisplay();
			xPos.text = "X Pos:";
			xPos.SetPositionTL(15, runningY);
			particlePropertiesGUI.Add(xPos);

			xPosTextBox = AddTextBox();
			xPosTextBox.sclX = 3;
			xPosTextBox.SetPositionTL(24, runningY);
			xPosTextBox.format = TextBox.FormatTypes.DECIMAL;
			xPosTextBox.onLosingFocus += new FrbGuiMessage(PropertyWindowMessages.xPosTextBoxLoseFocus);
			particlePropertiesGUI.Add(xPosTextBox);

			runningY += 2.5f;
//.........这里部分代码省略.........
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:101,代码来源:PropertyWindow.cs

示例7: LoadContent

        public override void LoadContent(ContentManager Content)
        {
            base.LoadContent(Content);

            wndPanel.LoadContent(Content);
            wndPanel.DrawWindow = false;

            UI.Button bClose = new UI.Button(new Rectangle(WindowRectangle.Width - 112, WindowRectangle.Height - 48, 96, 32));
            bClose.Parent = wndPanel;
            bClose.LoadContent(Content);
            bClose.Text = "Cancel";
            bClose.Clicked += bClose_Clicked;
            wndPanel.AddWindow("btnClose", bClose);

            UI.Button bCreate = new UI.Button(new Rectangle(WindowRectangle.Width - bClose.WindowRectangle.Width - 16 - 112, WindowRectangle.Height - 48, 96, 32));
            bCreate.Parent = wndPanel;
            bCreate.LoadContent(Content);
            bCreate.Text = "Create";
            bCreate.Clicked += bCreate_Clicked;
            wndPanel.AddWindow("btnCreate", bCreate);

            UI.ComboBox cboWorldType = new ComboBox(new Rectangle(WindowRectangle.X + 9, WindowRectangle.Y + 104, 256, 32));
            cboWorldType.LoadContent(Content);
            cboWorldType.AddItem("Forest Jungle");
            cboWorldType.AddItem("Prison Cells");
            cboWorldType.AddItem("Sandy Beach");
            cboWorldType.SelectedItem = "Forest Jungle";
            wndPanel.AddWindow("cboWorldType", cboWorldType);

            UI.Label lblWorldType = new UI.Label(new Rectangle(0, 74, wndPanel.WindowRectangle.Width, 20));
            lblWorldType.Parent = wndPanel;
            lblWorldType.LoadContent(Content);
            lblWorldType.Text = "World Type";
            wndPanel.AddWindow("lblWorldType", lblWorldType);

            UI.Label lblName = new UI.Label(new Rectangle(0, 12, wndPanel.WindowRectangle.Width, 20));
            lblName.Parent = wndPanel;
            lblName.LoadContent(Content);
            lblName.Text = "Level Name:";
            wndPanel.AddWindow("lblLvlName", lblName);

            UI.TextBox txtLevelName = new TextBox(new Rectangle(4, lblName.WindowRectangle.Height * 2, wndPanel.WindowRectangle.Width - 10, 32));
            txtLevelName.Parent = wndPanel;
            txtLevelName.LoadContent(Content);
            txtLevelName.Clicked += txtLevelName_Clicked;
            txtLevelName.OnTabPressed += txtLevelName_OnTabPressed;
            txtLevelName.Text = "bla";
            wndPanel.AddWindow("txtLevelName", txtLevelName);

            UI.Label lblSize = new UI.Label(new Rectangle(0, 140, wndPanel.WindowRectangle.Width, 20));
            lblSize.Parent = wndPanel;
            lblSize.LoadContent(Content);
            lblSize.Text = "World Size (In Tiles)";
            wndPanel.AddWindow("lblSize", lblSize);

            UI.Label lblWorldWidth = new UI.Label(new Rectangle(0, 180, 150, 20));
            lblWorldWidth.Parent = wndPanel;
            lblWorldWidth.LoadContent(Content);
            lblWorldWidth.Text = "World Width:";
            wndPanel.AddWindow("lblWorldWidth", lblWorldWidth);

            UI.Label lblWorldHeight = new UI.Label(new Rectangle(220, 180, 50, 20));
            lblWorldHeight.Parent = wndPanel;
            lblWorldHeight.LoadContent(Content);
            lblWorldHeight.Text = "World Height:";
            wndPanel.AddWindow("lblWorldHeight", lblWorldHeight);

            UI.TextBox txtWorldWidth = new TextBox(new Rectangle(140, 175, 80, 32));
            txtWorldWidth.Parent = wndPanel;
            txtWorldWidth.LoadContent(Content);
            txtWorldWidth.MaxLength = 3;
            txtWorldWidth.Clicked += txtLevelWidth_Clicked;
            txtWorldWidth.OnTabPressed += txtWorldWidth_OnTabPressed;
            txtWorldWidth.NumericBox = true;
            txtWorldWidth.Text = "22";
            wndPanel.AddWindow("txtLevelWidth", txtWorldWidth);

            UI.TextBox txtLevelHeight = new TextBox(new Rectangle(360, 175, 80, 32));
            txtLevelHeight.Parent = wndPanel;
            txtLevelHeight.LoadContent(Content);
            txtLevelHeight.NumericBox = true;
            txtLevelHeight.MaxLength = 3;
            txtLevelHeight.Text = "22";
            txtLevelHeight.Clicked += txtLevelHeight_Clicked;
            txtLevelHeight.OnTabPressed += txtLevelHeight_OnTabPressed;
            wndPanel.AddWindow("txtLevelHeight", txtLevelHeight);

            UI.CheckBox chkWater = new CheckBox(new Rectangle(4, WindowRectangle.Height - 48, 150, 24));
            chkWater.Parent = wndPanel;
            chkWater.LoadContent(Content);
            chkWater.Text = "Water Level";
            chkWater.WindowClicked += chkWater_WindowClicked;
            wndPanel.AddWindow("chkWater", chkWater);

            UI.TextBox txtWaterLevel = new TextBox(new Rectangle(160, WindowRectangle.Height - 48, 40, 32));
            txtWaterLevel.Parent = wndPanel;
            txtWaterLevel.LoadContent(Content);
            txtWaterLevel.NumericBox = true;
            txtWaterLevel.MaxLength = 1;
            txtWaterLevel.Text = DEFAULT_WATER_LEVEL;
//.........这里部分代码省略.........
开发者ID:ZetItUp,项目名称:LudumDare32,代码行数:101,代码来源:NewMapWindow.cs

示例8: TestComboBoxSelectedItems

 public void TestComboBoxSelectedItems()
 {
     ComboBox box = new ComboBox("box");
     Assert.AreEqual(box, box.AddItem("item1"));
     Assert.AreEqual("item1", box.SelectedItems()[0]);
 }
开发者ID:codehaus,项目名称:fest-git,代码行数:6,代码来源:ComponentTest.cs


注:本文中的ComboBox.AddItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。