GetItemCheckState() public method

public GetItemCheckState ( int index ) : CheckState
index int
return CheckState
        public void DrawAllLayers(Graphics aGfx, int lX, int lY, int lW, int lH)
        {
            for (int i = 0; i < mlstTileLayers.Count; i++)
            {
                if (objLayerList.GetItemCheckState(i) == CheckState.Checked)
                {
                    bool bGrid = false;

                    if (mlSelectedLayer == i && mMainForm.objTileGridCheckBox.Checked)
                    {
                        bGrid = true;
                    }

                    ((cTileLayer)mlstTileLayers[i]).Draw(aGfx, lX, lY, lW, lH, bGrid);
                }
            }
        }
Esempio n. 2
0
        //<Snippet2>
        private void WhatIsChecked_Click(object sender, System.EventArgs e)
        {
            // Display in a message box all the items that are checked.

            // First show the index and check state of all selected items.
            foreach (int indexChecked in checkedListBox1.CheckedIndices)
            {
                // The indexChecked variable contains the index of the item.
                MessageBox.Show("Index#: " + indexChecked.ToString() + ", is checked. Checked state is:" +
                                checkedListBox1.GetItemCheckState(indexChecked).ToString() + ".");
            }

            // Next show the object title and check state for each item selected.
            foreach (object itemChecked in checkedListBox1.CheckedItems)
            {
                // Use the IndexOf method to get the index of an item.
                MessageBox.Show("Item with title: \"" + itemChecked.ToString() +
                                "\", is checked. Checked state is: " +
                                checkedListBox1.GetItemCheckState(checkedListBox1.Items.IndexOf(itemChecked)).ToString() + ".");
            }
        }
		public void CheckedListBoxPropertyTest () 
		{
			Form myform = new Form ();
			myform.ShowInTaskbar = false;
			myform.Visible = true;
			CheckedListBox mychklistbox = new CheckedListBox ();
			ArrayList checked_items = new ArrayList (2);
			ArrayList checked_pos = new ArrayList (2);
			mychklistbox.Items.Add ("test1", true);
			checked_items.Add ("test1"); checked_pos.Add (0);
			mychklistbox.Items.Add ("test2");
			mychklistbox.Items.Add ("test3", true);
			checked_items.Add ("test3"); checked_pos.Add (2);
			mychklistbox.Visible = true;
			myform.Controls.Add (mychklistbox);
			Assert.AreEqual (checked_items.Count, mychklistbox.CheckedIndices.Count, "#1");
			Assert.AreEqual (checked_items.Count, mychklistbox.CheckedItems.Count, "#2");
			foreach (object o in mychklistbox.CheckedItems) 
			{
				Assert.IsTrue (checked_items.Contains (o),"#3");
				checked_items.Remove (o);
			}

			Assert.AreEqual (0, checked_items.Count);
			for (int i = 0; i < mychklistbox.Items.Count; ++i) 
			{
				if (checked_pos.Contains (i))
					Assert.AreEqual (CheckState.Checked, mychklistbox.GetItemCheckState (i),"#4");
				else
					Assert.IsFalse (CheckState.Checked == mychklistbox.GetItemCheckState (i),"#5");
			}
			Assert.AreEqual (false, mychklistbox.CheckOnClick, "#6");
			Assert.AreEqual (3, mychklistbox.Items.Count, "#7");
			Assert.AreEqual (SelectionMode.One, mychklistbox.SelectionMode, "#8");
			Assert.AreEqual (false , mychklistbox.ThreeDCheckBoxes, "#9");
			myform.Dispose ();
		}
Esempio n. 4
0
        private void AddPieTheme()
        {
            FeatureLayer selected = layers.SelectedItem as FeatureLayer;

            if (selected != null)
            {
                // Collect list of columns to use:
                ArrayList list = new ArrayList();
                for (int i = 0; i < fields.Items.Count; i++)
                {
                    if (fields.GetItemCheckState(i) == CheckState.Checked)
                    {
                        list.Add(fields.Items[i]);
                    }
                }

                // If there are any, then add the theme:
                if (list.Count > 0)
                {
                    try
                    {
                        PieTheme theme = new PieTheme(
                            mapControl1.Map,
                            selected.Table,
                            (string[])list.ToArray(typeof(string))
                            );
                        ObjectThemeLayer themeLayer = new ObjectThemeLayer(
                            "World Pop Growth Rate", null, theme);

                        mapControl1.Map.Layers.Add(themeLayer);
                        theme.DataValueAtSize *= 2;
                        theme.GraduateSizeBy   = GraduateSizeBy.Constant;
                        themeLayer.RebuildTheme();
                    }
                    catch (Exception e)
                    {
                        for (int i = 0; i < fields.Items.Count; i++)
                        {
                            fields.SetItemCheckState(i, CheckState.Unchecked);
                        }
                        System.Windows.Forms.MessageBox.Show("Error: \n" + e.ToString(), "PieTheme Error");
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Event Handler from MoveUp and MoveDown Button Click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMove_Click(object sender, System.EventArgs e)
        {
            // Declare the current and destination indices of the
            // real time stylus plugin being moved.
            int currentIndex     = chklbPlugins.SelectedIndex;
            int destinationIndex = -1;

            if ((0 <= currentIndex) && (currentIndex <= chklbPlugins.Items.Count))
            {
                // Calculate the destination based on whether move up
                // or down was pressed.
                if (sender == btnMoveUp)
                {
                    destinationIndex = currentIndex - 1;
                }
                else
                {
                    destinationIndex = currentIndex + 1;
                }

                // The destination index of the plugin being moved must fall
                // within the bounds of the plugin list.
                if ((0 <= destinationIndex) && (destinationIndex < chklbPlugins.Items.Count))
                {
                    CheckState checkState = chklbPlugins.GetItemCheckState(currentIndex);

                    // If the plugin being moved is currently enabled,
                    // remove it from the plugin collection.
                    if (CheckState.Checked == checkState)
                    {
                        RemoveFromPluginCollection(currentIndex);
                    }

                    // Update the checked list box to reflect the move.
                    object item = chklbPlugins.Items[currentIndex];
                    chklbPlugins.Items.RemoveAt(currentIndex);
                    chklbPlugins.Items.Insert(destinationIndex, item);

                    // Restore the selected and checked state of the list item.
                    chklbPlugins.SetSelected(destinationIndex, true);
                    chklbPlugins.SetItemCheckState(destinationIndex, checkState);
                }
            }
        }
        private void UpdateCheckboxes(int idx)
        {
            IEnumerator myEnumerator;
            int         i;

            bool[] resultVialChecks = new bool[8];
            for (i = 0; i < 8; ++i)
            {
                resultVialChecks[i] = false;
            }
            myEnumerator = lbDefaultNames.CheckedIndices.GetEnumerator();
            while (myEnumerator.MoveNext() != false)
            {
                i = (int)myEnumerator.Current;
                resultVialChecks[i] = true;
            }

            try
            {
                i = lbDefaultNames.Items.IndexOf(SeparatorResourceManager.GetSeparatorString(StringId.SampleTube));
                results.sampleTube = lbDefaultNames.GetItemCheckState(i) == CheckState.Checked;
                i = lbDefaultNames.Items.IndexOf(SeparatorResourceManager.GetSeparatorString(StringId.SeparationTube));
                results.separationTube = lbDefaultNames.GetItemCheckState(i) == CheckState.Checked;
                i = lbDefaultNames.Items.IndexOf(SeparatorResourceManager.GetSeparatorString(StringId.WasteTube));
                results.wasteTube = lbDefaultNames.GetItemCheckState(i) == CheckState.Checked;
                i = lbDefaultNames.Items.IndexOf(SeparatorResourceManager.GetSeparatorString(StringId.QuadrantBuffer));
                results.bufferBottle = lbDefaultNames.GetItemCheckState(i) == CheckState.Checked;
                i = lbDefaultNames.Items.IndexOf(SeparatorResourceManager.getLysisStringFromProtocolClass(protocolClass));
                results.lysisBufferTube = lbDefaultNames.GetItemCheckState(i) == CheckState.Checked;

                //for rs16
                i = lbDefaultNames.Items.IndexOf(SeparatorResourceManager.GetSeparatorString(StringId.QuadrantBuffer34));
                results.bufferBottle34 = lbDefaultNames.GetItemCheckState(i) == CheckState.Checked;
                i = lbDefaultNames.Items.IndexOf(SeparatorResourceManager.GetSeparatorString(StringId.QuadrantBuffer56));
                results.bufferBottle56 = lbDefaultNames.GetItemCheckState(i) == CheckState.Checked;
            }
            catch (Exception) {}

            //resultVialChecks[0]=false;
            //lbDefaultNames.SetItemCheckState(0,CheckState.Unchecked);

            //theProtocolModel.UpdateResultVialChecks(idx, resultVialChecks);
            theProtocolModel.UpdateResultVialChecks(idx, results);
        }
Esempio n. 7
0
        public override ToggleState GetItemToggleState(ListItemProvider item)
        {
            if (ContainsItem(item) == true)
            {
                SWF.CheckedListBox checkedListBox = (SWF.CheckedListBox)Control;

                SWF.CheckState state = checkedListBox.GetItemCheckState(item.Index);
                switch (state)
                {
                case SWF.CheckState.Checked:
                    return(ToggleState.On);

                case SWF.CheckState.Unchecked:
                    return(ToggleState.Off);

                default:
                    return(ToggleState.Indeterminate);
                }
            }
            else
            {
                return(ToggleState.Indeterminate);
            }
        }
Esempio n. 8
0
        private void clbPackets_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            int index = clbPackets.SelectedIndex;

            UpdateDetails(clbPackets.GetItemCheckState(index));
        }
		public void SetItemCheckStateTest ()
		{
			Form myform = new Form ();
			myform.ShowInTaskbar = false;
			myform.Visible = true;
			CheckedListBox mychklistbox = new CheckedListBox ();
			mychklistbox.Items.Add ("test1");
			mychklistbox.Items.Add ("test2");
			mychklistbox.Items.Add ("test3");
			mychklistbox.Visible = true;
			myform.Controls.Add (mychklistbox);
			mychklistbox.SetItemCheckState (0,CheckState.Checked);
			mychklistbox.SetItemCheckState (1,CheckState.Indeterminate);
			mychklistbox.SetItemCheckState (2,CheckState.Unchecked);
			Assert.AreEqual (CheckState.Checked, mychklistbox.GetItemCheckState (0), "#19");
			Assert.AreEqual (CheckState.Indeterminate, mychklistbox.GetItemCheckState (1), "#20");
			Assert.AreEqual (CheckState.Unchecked, mychklistbox.GetItemCheckState (2), "#21");
			myform.Dispose ();
		}
Esempio n. 10
0
		public void SetItemCheckedTest ()
		{
			Form myform = new Form ();
			myform.ShowInTaskbar = false;
			myform.Visible = true;
			CheckedListBox mychklistbox = new CheckedListBox ();
			mychklistbox.Items.Add ("test1");
			mychklistbox.Items.Add ("test2");
			mychklistbox.Visible = true;
			myform.Controls.Add (mychklistbox);
			mychklistbox.SetItemChecked (0,true);
			mychklistbox.SetItemChecked (1,false);
			Assert.AreEqual (CheckState.Checked, mychklistbox.GetItemCheckState (0), "#17");
			Assert.AreEqual (CheckState.Unchecked, mychklistbox.GetItemCheckState (1), "#18");
			myform.Dispose ();
		}
Esempio n. 11
0
		public void GetItemCheckStateTest ()
		{
			Form f = new Form ();
			f.ShowInTaskbar = false;
			f.Visible = true;
			CheckedListBox mychklistbox = new CheckedListBox ();
			mychklistbox.Items.Add ("test1",true);
			mychklistbox.Items.Add ("test2",CheckState.Indeterminate);
			mychklistbox.Items.Add ("test3");
			mychklistbox.Visible = true;
			f.Controls.Add (mychklistbox);
			Assert.AreEqual (CheckState.Checked, mychklistbox.GetItemCheckState (0), "#14");
			Assert.AreEqual (CheckState.Indeterminate, mychklistbox.GetItemCheckState (1), "#15");
			Assert.AreEqual (CheckState.Unchecked, mychklistbox.GetItemCheckState (2), "#16");
			f.Dispose ();
		}
Esempio n. 12
0
        private void generateButton_Click(object sender, System.EventArgs e)
        {
            DirectoryInfo outputDir = new DirectoryInfo(outputPathTextBox.Text);

            if (outputDir.Exists == false)
            {
                MessageBox.Show(this, "Output Path is invalid", "Code Generator");
                return;
            }

            // POSIX, Windows, PocketPC Code Generation
            LibraryGenerator libgen = new LibraryGenerator();

            genOutputTextBox.Clear();

            switch (platformComboBox.SelectedIndex)
            {
            case 0:
                libgen.Platform  = LibraryGenerator.PLATFORMS.POSIX;
                libgen.SubTarget = LibraryGenerator.SUBTARGETS.NONE;
                break;

            case 1:
                libgen.Platform  = LibraryGenerator.PLATFORMS.WINDOWS;
                libgen.SubTarget = LibraryGenerator.SUBTARGETS.NONE;
                libgen.WinSock   = 1;
                break;

            case 2:
                libgen.Platform  = LibraryGenerator.PLATFORMS.WINDOWS;
                libgen.SubTarget = LibraryGenerator.SUBTARGETS.NONE;
                libgen.WinSock   = 2;
                break;

            case 3:
                libgen.Platform  = LibraryGenerator.PLATFORMS.WINDOWS;
                libgen.SubTarget = LibraryGenerator.SUBTARGETS.PPC2003;
                libgen.WinSock   = 1;
                break;
            }

            switch (languageComboBox.SelectedIndex)
            {
            case 0:
                libgen.Language = LibraryGenerator.LANGUAGES.C;
                break;

            case 1:
                libgen.Language = LibraryGenerator.LANGUAGES.CPP;
                break;
            }

            switch (newLineComboBox.SelectedIndex)
            {
            case 0:
                libgen.CodeNewLine = "\r\n";
                break;

            case 1:
                libgen.CodeNewLine = "\n";
                break;
            }

            switch (callConventionComboBox.SelectedIndex)
            {
            case 0:
                libgen.CallingConvention = ""; break;

            case 1:
                libgen.CallingConvention = "_stdcall "; break;

            case 2:
                libgen.CallingConvention = "_fastcall "; break;
            }

            switch (indentComboBox.SelectedIndex)
            {
            case 0:
                libgen.CodeTab = "\t"; break;

            case 1:
                libgen.CodeTab = " "; break;

            case 2:
                libgen.CodeTab = "  "; break;

            case 3:
                libgen.CodeTab = "   "; break;

            case 4:
                libgen.CodeTab = "    "; break;

            case 5:
                libgen.CodeTab = "     "; break;

            case 6:
                libgen.CodeTab = "      "; break;
            }

            libgen.CallPrefix    = libPrefixTextBox.Text;
            libgen.CallLibPrefix = libPrefixTextBox.Text;
            libgen.VersionString = "Intel DeviceBuilder Build#" + Application.ProductVersion;
            libgen.ClassName     = classNameTextBox.Text;

            // Setup License
            string license = licenseTextBox.Text;

            license        = license.Replace("<AUTHOR>", "Intel Corporation, Intel Device Builder");
            license        = license.Replace("<REVISION>", "#" + Application.ProductVersion);
            license        = license.Replace("<DATE>", DateTime.Now.ToLongDateString());
            libgen.License = license;

            string lib;

            if (modulesCheckedListBox.GetItemCheckState(3) == CheckState.Checked)
            {
                SourceCodeRepository.Generate_AsyncSocket(libPrefixTextBox.Text, outputDir);
            }
            if (modulesCheckedListBox.GetItemCheckState(4) == CheckState.Checked)
            {
                SourceCodeRepository.Generate_AsyncServerSocket(libPrefixTextBox.Text, outputDir);
            }
            if (modulesCheckedListBox.GetItemCheckState(5) == CheckState.Checked)
            {
                SourceCodeRepository.Generate_WebClient(libPrefixTextBox.Text, outputDir, false);
            }
            if (modulesCheckedListBox.GetItemCheckState(6) == CheckState.Checked)
            {
                SourceCodeRepository.Generate_WebServer(libPrefixTextBox.Text, outputDir, false);
            }

            libgen.OnLogOutput += new LibraryGenerator.LogOutputHandler(Log);
            try
            {
                if (modulesCheckedListBox.GetItemCheckState(0) == CheckState.Checked)
                {
                    SourceCodeRepository.Generate_Parsers(libPrefixTextBox.Text, outputDir);
                }
                if (modulesCheckedListBox.GetItemCheckState(1) == CheckState.Checked)
                {
                    libgen.Build_UPnPHTTPClient(outputDir);
                }
                if (modulesCheckedListBox.GetItemCheckState(2) == CheckState.Checked)
                {
                    SourceCodeRepository.Generate_SSDPClient(libPrefixTextBox.Text, outputDir, true);
                }
            }
            catch
            {
                MessageBox.Show(this, "Error Generating Code", "Code Generator");
            }

            libgen.OnLogOutput -= new LibraryGenerator.LogOutputHandler(Log);
        }
Esempio n. 13
0
        /// <summary>
        /// 角色选择状态改变
        /// </summary>
        private string UserCKChangeSet(CheckedListBox checkbox)
        {
            string checkStr = "";
            if (checkbox.Items.Count > 0)
            {
                for (int i = 0; i < checkbox.Items.Count; i++)
                {
                    if (checkbox.GetItemCheckState(i) == CheckState.Checked)
                    {
                        checkbox.SelectedIndex = i;
                        checkStr += checkbox.SelectedValue + ",";

                    }
                }
            }
            return checkStr;
        }
Esempio n. 14
0
File: OSD.cs Progetto: bob01/mavosd
        private void copyPanelItems(Tuple<string, Func<int, int, int>, int, int, int, int, int>[] panelSrc, 
                                    CheckedListBox listSrc, 
                                    Tuple<string, Func<int, int, int>, int, int, int, int, int>[] panelDest, 
                                    CheckedListBox listDest)
        {
            for (int a = 0; a < panelSrc.Length; a++)
            {
                if (panelSrc[a] != null)
                {
                    // copy panel item
                    panelDest[a] = new Tuple<string,Func<int,int,int>,int,int,int,int,int>(
                        panelSrc[a].Item1, panelSrc[a].Item2, panelSrc[a].Item3, panelSrc[a].Item4, panelSrc[a].Item5, panelSrc[a].Item6, panelSrc[a].Item7);

                    // copy checked item list
                    listDest.SetItemCheckState(a, listSrc.GetItemCheckState(a));
                }
                else
                {
                    panelDest[a] = null;
                }
            }
        }
Esempio n. 15
0
 /// <summary>
 /// Left mouse click: check/uncheck the item.
 /// Middle mouse click: remove item.
 /// Right mouse click: send item from chList1 to chList2.
 /// </summary>
 /// <param name="chList1"> The handled checkedListBox. </param>
 /// <param name="chList2"> The dual checkedListBox. </param>
 /// <param name="e"> The mouse click event. </param>
 public static void DualChListMouseEvent(CheckedListBox chList1, CheckedListBox chList2, MouseEventArgs e, Point mousePosition, bool useDual = true)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         for (int i = 0; i < chList1.Items.Count; i++)
         {
             if (i != 0 || useDual)
             {
                 if (chList1.GetItemRectangle(i).Contains(chList1.PointToClient(mousePosition)))
                 {
                     chList2.AddOrderedFromBottom(chList1.GetText(i), chList1.GetItemChecked(i));
                     chList1.Items.RemoveAt(i);
                 }
             }
         }
     }
     else if (e.Button == System.Windows.Forms.MouseButtons.Middle)
     {
         for (int i = 0; i < chList1.Items.Count; i++)
         {
             if (i != 0 || useDual)
             {
                 if (chList1.GetItemRectangle(i).Contains(chList1.PointToClient(mousePosition)))
                 {
                     chList1.Items.RemoveAt(i);
                 }
             }
         }
     }
     else if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         for (int i = 0; i < chList1.Items.Count; i++)
         {
             if (chList1.GetItemRectangle(i).Contains(chList1.PointToClient(mousePosition)))
             {
                 switch (chList1.GetItemCheckState(i))
                 {
                     case CheckState.Checked:
                         chList1.SetItemCheckState(i, CheckState.Unchecked);
                         break;
                     case CheckState.Indeterminate:
                     case CheckState.Unchecked:
                         chList1.SetItemCheckState(i, CheckState.Checked);
                         break;
                 }
             }
         }
     }
 }
Esempio n. 16
0
        /*
         *  Returns a list of the a checked characters in the passed in checked list box
         */
        private List<int> getCheckedItemsInCheckedListBox(CheckedListBox checkedListbox)
        {
            List<int> checkedItems = new List<int>();

            // Get all checked items in checkbox list
            for (int i = 0; i < checkedListbox.Items.Count; i++)
            {
                if (checkedListbox.GetItemCheckState(i) == CheckState.Checked)
                {
                    checkedItems.Add(i);
                }
            }

            return checkedItems;
        }
Esempio n. 17
0
 private string[] GetStringsFromCheckedListBox(CheckedListBox checkedListBox)
 {
     string[] checkedItems = new string[checkedListBox.Items.Count];
     for (int index = 0; index < checkedListBox.Items.Count; ++index)
     {
         string selectedItemName = checkedListBox.Items[index] as string;
         checkedItems[index] = string.Format(CultureInfo.InvariantCulture, "{0},{1}", selectedItemName,
             Convert.ToString((checkedListBox.GetItemCheckState(index) == CheckState.Checked), CultureInfo.InvariantCulture));
     }
     return checkedItems;
 }