ClearSelected() public method

public ClearSelected ( ) : void
return void
示例#1
0
 public static bool Intercambiar(ListBox listaA, ListBox listaB, Stack destino, Stack origen)
 {
     Object item = listaB.SelectedItem;
     if (item.ToString() != origen.Peek().ToString())
     {
         MessageBox.Show("El elemnto no se puede mover", "Torres de Hanoi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         listaB.ClearSelected();
     }
     else{
         if (destino.Count == 0 || ((int)origen.Peek() < (int)destino.Peek()))
         {
             listaA.Items.Insert(0, item);
             listaB.Items.Remove(item);
             destino.Push(origen.Peek());
             origen.Pop();
             return true;
         }
     else
         {
             MessageBox.Show("Movimiento no valido", "Torres de Hanoi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             listaB.ClearSelected();
         }
     }
     return false;
 }
示例#2
0
 /// <summary>
 /// Event handler for Form::Load
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void WeatherItemSelectionDlg_Load(object sender, System.EventArgs e)
 {
     txtSelect.Text = "";
     //btnRefreshList.Visible  = true;
     //progressBar1.Visible    = false;
     lstWeatherItemNames.ClearSelected();
 }
示例#3
0
 private void trackBar1_ValueChanged(object sender, EventArgs e)
 {
     if (!inListboxChanging)
     {
         listBox1.ClearSelected();
     }
     this.groupBox1.Text = String.Format("Density: {0}",
                                         ScaleDensity(this.trackBar1.Value));
 }
 public void Clear()
 {
     if (_owner is not null)
     {
         _owner.ClearSelected();
     }
 }
 public void Clear()
 {
     if (owner != null)
     {
         owner.ClearSelected();
     }
 }
示例#6
0
 /// <summary>
 /// Reset all Form data
 /// </summary>
 private void ResetForm()
 {
     //Clear Objects
     listOfficeWorksFields.ClearSelected();
     txtBookmark.Text     = "";
     radioButton1.Checked = true;
     groupBox1.Enabled    = false;
     chkRequired.Checked  = false;
 }
		private void DeselectAll()
		{
			lstSellWeapon.ClearSelected();
			lstSellShield.ClearSelected();
			lstSellGadget.ClearSelected();
			lstBuyWeapon.ClearSelected();
			lstBuyShield.ClearSelected();
			lstBuyGadget.ClearSelected();
		}
示例#8
0
 private void checkMulti_CheckedChanged(object sender, EventArgs e)
 {
     if (checkMulti.Checked && PrefC.IsODHQ)             //If user is in checkMulti state, deselect the list
     {
         listMain.ClearSelected();
         textFilter.Focus();
     }
     SetLabelText();
 }
示例#9
0
            private void AddPlace(FileDialogPlaceBase place)
            {
                m_places.Add(place);
                ((CurrencyManager)placesListBox.BindingContext[m_places]).Refresh();

                bool            multipleLines;
                ToolStripButton placeButton = new ToolStripButton(FileDialog.InsertLineBreaks(place.Text, out multipleLines));

                placeButton.Image             = ShellImageList.GetImage(place.PIDL);
                placeButton.ImageAlign        = ContentAlignment.BottomCenter;
                placeButton.Margin            = new Padding(1, 0, 0, 0);
                placeButton.Padding           = new Padding(0, multipleLines ? 3 : 8, 0, multipleLines ? 0 : 8);
                placeButton.Tag               = place;
                placeButton.TextImageRelation = TextImageRelation.ImageAboveText;
                placesBar.Items.Add(placeButton);

                placesListBox.ClearSelected();
                placesListBox.SelectedIndex = placesListBox.Items.Count - 1;
            }
 public static void SetObjectTimeSlots(ListBox listBoxRoom, IEnumerable<TimeSlot> timeSlots)
 {
     listBoxRoom.ClearSelected();
     foreach (var timeSlot in timeSlots)
     {
         for (uint i = timeSlot.StartHour; i < timeSlot.EndHour; i++)
         {
             listBoxRoom.SetSelected((int)i - 7, true);
         }
     }
 }
示例#11
0
        private void btnMoveUp_Click(object sender, System.EventArgs e)
        {
            ListBox.SelectedIndexCollection indices = lstPhotos.SelectedIndices;
            int[] newSelects = new int[indices.Count];

            // Move the selected items up
            for (int i = 0; i < indices.Count; i++)
            {
                int index = indices[i];
                _album.MoveBefore(index);
                newSelects[i] = index - 1;
            }

            _bAlbumChanged = true;
            UpdateList();

            // Reset the selections.
            lstPhotos.ClearSelected();
            foreach (int x in newSelects)
            {
                lstPhotos.SetSelected(x, true);
            }
        }
示例#12
0
    private void cboSelectionMode_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        // Allow the user to select from one of the selection modes:

        // One, MultipleSimple, MultipleExtended

        try {
            lstMultiSelect.ClearSelected();
            lstMultiSelect.SelectionMode = (SelectionMode)(System.Enum.Parse(typeof(SelectionMode), cboSelectionMode.Text));
        } catch (Exception exp)
        {
            MessageBox.Show(exp.Message, this.Text);
        }
    }
        /// <summary>
        /// Refreshes the list box items for the resolutions tab
        /// </summary>
        /// <param name="removeSelected">Removes the selected item</param>
        public void RefreshForm(ListBox listBox, bool removeSelected)
        {
            if (removeSelected)
            {
                object o = listBox.SelectedItem.ToString();

                // Remove the current selected item
                listBox.Items.Remove(o);

                // Remove the auto change item
                listBox.Items.Remove(o);
            }

            // Clear the selected items
            listBox.ClearSelected();
        }
示例#14
0
        //<Snippet1>
        private void RemoveTopItems()
        {
            // Determine if the currently selected item in the ListBox
            // is the item displayed at the top in the ListBox.
            if (listBox1.TopIndex != listBox1.SelectedIndex)
            {
                // Make the currently selected item the top item in the ListBox.
                listBox1.TopIndex = listBox1.SelectedIndex;
            }

            // Remove all items before the top item in the ListBox.
            for (int x = (listBox1.SelectedIndex - 1); x >= 0; x--)
            {
                listBox1.Items.RemoveAt(x);
            }

            // Clear all selections in the ListBox.
            listBox1.ClearSelected();
        }
 private void CreateList(object newCard, object cardList, CardType cardType)
 {
     if (cardType == CardType.CHARACTER)
     {
         var cards = (List<CharacterCard>)cardList;
         cards.Add((CharacterCard)newCard);
         lstPlayerCards.DataSource = cards;
     }
     else
     {
         var cards = (List<EventCard>)cardList;
         cards.Add((EventCard)newCard);
         lstPlayerCards.DataSource = cards;
         _characterBox = new ListBox();
         Width = Width + 110;
         _characterBox.Location = new Point(280, 12);
         _characterBox.Height = lstPlayerCards.Height;
         _characterBox.Width = 100;
         this.Controls.Add(_characterBox);
         _characterBox.DataSource = ((EventCard)lstPlayerCards.SelectedItem).Characters;
         _characterBox.ClearSelected();
     }
 }
示例#16
0
        private void FillForm()
        {
            //this is not refined enough to be called more than once on the form because it will not
            //remember the toolbars that were selected.
            ToolButItems.RefreshCache();
            ProgramProperties.RefreshCache();
            textProgName.Text      = ProgramCur.ProgName;
            textProgDesc.Text      = ProgramCur.ProgDesc;
            checkEnabled.Checked   = ProgramCur.Enabled;
            textPath.Text          = ProgramCur.Path;
            textCommandLine.Text   = ProgramCur.CommandLine;
            textPluginDllName.Text = ProgramCur.PluginDllName;
            textNote.Text          = ProgramCur.Note;
            pictureBox.Image       = PIn.Bitmap(ProgramCur.ButtonImage);
            List <ToolButItem> itemsForProgram = ToolButItems.GetForProgram(ProgramCur.ProgramNum);

            listToolBars.Items.Clear();
            for (int i = 0; i < Enum.GetNames(typeof(ToolBarsAvail)).Length; i++)
            {
                listToolBars.Items.Add(Enum.GetNames(typeof(ToolBarsAvail))[i]);
            }
            for (int i = 0; i < itemsForProgram.Count; i++)
            {
                listToolBars.SetSelected((int)itemsForProgram[i].ToolBar, true);
            }
            if (!AllowToolbarChanges)             //As we add more static bridges, we will need to enhance this to show/hide controls as needed.
            {
                listToolBars.ClearSelected();
                listToolBars.Enabled = false;
            }
            if (itemsForProgram.Count > 0)          //the text on all buttons will be the same for now
            {
                textButtonText.Text = itemsForProgram[0].ButtonText;
            }
            FillGrid();
        }
示例#17
0
 private void UpdateListBoxItem(ListBox lb, object item)
 {
     int index = lb.Items.IndexOf(item);
     int currentIndex = lb.SelectedIndex;
     lb.BeginUpdate();
     try
     {
         lb.ClearSelected();
         lb.Items[index] = item;
         lb.SelectedIndex = currentIndex;
     }
     finally
     {
         lb.EndUpdate();
     }
 }
示例#18
0
        /// <summary>
        /// Add the selected items from the specified source <c>ListBox</c> control to the specified destination <c>ListBox</c> control.
        /// </summary>
        /// <param name="listSource">The source <c>ListBox</c> control.</param>
        /// <param name="listDestination">the destination <c>ListBox</c> control.</param>
        protected virtual void Add(ref ListBox listSource, ref ListBox listDestination)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            int count = listSource.SelectedItems.Count;
            int currentIndex = listSource.SelectedIndex;

            // Skip, if no items have been selected.
            if (count == 0)
            {
                return;
            }

			if ((m_ListItemCount + count) > EntryCountMax)
            {
                MessageBox.Show(Resources.MBTWorksetDefineMaxExceeded, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            Cursor = Cursors.WaitCursor;

            // ------------------------------------------------------------------------------------------------------------------------------
            // For each selected item: (a) add this to the destination list; (b) delete from the source list and (c) update the added flag.
            // ------------------------------------------------------------------------------------------------------------------------------
            int oldIdentifier;
            for (int index = 0; index < count; ++index)
            {
                // Add the item to the destination list.
                listDestination.Items.Add(listSource.SelectedItems[index]);

                // Keep track of the number of watch elements that have been added to the workset.
                m_ListItemCount++;

                oldIdentifier = ((WatchItem_t)listSource.SelectedItems[index]).OldIdentifier;

                // Keep track of which watch variables have been removed.
                m_WatchItems[oldIdentifier].Added = true;

                AddSupplementalFields(oldIdentifier);
            }

            // Remember the selected item list contents will change every time an item is deleted. The best approach is to repeatedly remove the selected items
            // collection for index = 0 by the number of items added to the destination list.
            for (int index = 0; index < count; ++index)
            {
                // Keep track of these changes in case the user selects the cancel key.
				m_AddedWatchVariables.Add(listSource.SelectedItems[0]);

                listSource.Items.Remove(listSource.SelectedItems[0]);
            }

            UpdateCount();

            // Highlight the next item for processing if the list is not empty.
            if (listSource.Items.Count > 0)
            {
                // Bounds checking.
                if (currentIndex < listSource.Items.Count)
                {
                    listSource.SelectedIndex = currentIndex;
                }
                else if (currentIndex == listSource.Items.Count)
                {
                    listSource.SelectedIndex = currentIndex - 1;
                }
            }

            // Scroll to the end of the list.
            listDestination.SetSelected(listDestination.Items.Count - 1, true);
            listDestination.ClearSelected();

            EnableApplyAndOKButtons();
            OnDataUpdate(this, new EventArgs());
            Cursor = Cursors.Default;
        }
示例#19
0
        /// <summary>
        /// Add the selected items from the specified source <c>ListBox</c> control to the specified destination <c>ListBox</c> control.
        /// </summary>
        /// <param name="listSource">The source <c>ListBox</c> control.</param>
        /// <param name="listDestination">the destination <c>ListBox</c> control.</param>
        protected override void Add(ref ListBox listSource, ref ListBox listDestination)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            int count = listSource.SelectedItems.Count;
            int currentIndex = listSource.SelectedIndex;

            // Skip, if no items have been selected.
            if (count == 0)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;

            // ------------------------------------------------------------------------------------------------------------------------------
            // For each selected item: (a) add this to the destination list; (b) delete from the source list and (c) update the removed flag.
            // ------------------------------------------------------------------------------------------------------------------------------
            int oldIdentifier;
            for (int index = 0; index < count; ++index)
            {
                // Add the item to the destination list.
                listDestination.Items.Add(listSource.SelectedItems[index]);

                // Keep track of the number of watch elements that have been added to the workset.
                m_ListItemCount++;

                oldIdentifier = ((WatchItem_t)listSource.SelectedItems[index]).OldIdentifier;

                // Keep track of which watch variables have been removed.
                m_WatchItems[oldIdentifier].Added = true;

                AddSupplementalFields(oldIdentifier);
            }

            UpdateCount();

            // Highlight the next item for processing if the list is not empty.
            if (listSource.Items.Count > 0)
            {
                // Bounds checking.
                if (currentIndex < listSource.Items.Count)
                {
                    listSource.SelectedIndex = currentIndex;
                }
                else if (currentIndex == listSource.Items.Count)
                {
                    listSource.SelectedIndex = currentIndex - 1;
                }
            }

            // Scroll to the end of the list.
            listDestination.SetSelected(listDestination.Items.Count - 1, true);
            listDestination.ClearSelected();

            EnableApplyAndOKButtons();
            OnDataUpdate(this, new EventArgs());
            Cursor = Cursors.Default;
        }
示例#20
0
        public static Control CreatePartners(Indicator indicator, string val, ErrorProvider indicatorErrors, List<DynamicContainer> controlList)
        {
            var container = new DynamicContainer { Indicator = indicator };
            var cntrl = new ListBox { Name = "dynamicPartners" + indicator.Id.ToString(), Width = 220, Height = 100, Margin = new Padding(0, 5, 20, bottomPadding), SelectionMode = SelectionMode.MultiExtended };

            List<Partner> partners = GetAndLoadPartners(cntrl);
            cntrl.ValueMember = "Id";
            cntrl.DisplayMember = "DisplayName";
            if (!string.IsNullOrEmpty(val))
            {
                string[] vals = val.Split('|');
                cntrl.ClearSelected();
                foreach (var av in partners.Where(v => vals.Contains(v.Id.ToString())))
                    cntrl.SelectedItems.Add(av);
            }

            container.GetValue = () =>
            {
                List<string> selected = new List<string>();
                foreach (var i in cntrl.SelectedItems)
                    selected.Add((i as Partner).Id.ToString());
                return string.Join("|", selected.ToArray());
            };

            container.IsValid = () =>
            {
                if (indicator.IsRequired && indicatorErrors != null)
                {
                    if (string.IsNullOrEmpty(container.GetValue()))
                    {
                        indicatorErrors.SetError(cntrl, Translations.Required);
                        return false;
                    }
                    else
                        indicatorErrors.SetError(cntrl, "");
                }
                return true;
            };
            cntrl.Validating += (s, e) => { container.IsValid(); };

            // Add table container and link
            controlList.Add(container);
            cntrl.Margin = new Padding(0, 5, 20, 0);
            TableLayoutPanel tblContainer = new TableLayoutPanel { AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink, AutoScroll = true };
            tblContainer.RowStyles.Clear();
            tblContainer.ColumnStyles.Clear();
            int cRow = tblContainer.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize });
            tblContainer.Controls.Add(cntrl, 0, cRow);
            int lRow = tblContainer.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize });
            var lnk = new H3Link { Text = Translations.AddNewItemLink, Margin = new Padding(0, 0, 3, bottomPadding) };
            lnk.ClickOverride += () =>
            {
                PartnerList list = new PartnerList();
                list.OnSave += () =>
                {
                    partners = GetAndLoadPartners(cntrl);
                };
                list.ShowDialog();
            };
            tblContainer.Controls.Add(lnk, 0, lRow);

            return tblContainer;
        }
示例#21
0
        public static Control CreateMulti(Indicator indicator, string val, ErrorProvider indicatorErrors, List<DynamicContainer> controlList,
            IndicatorEntityType entityType, List<IndicatorDropdownValue> dropdownKeys)
        {
            List<IndicatorDropdownValue> availableValues = new List<IndicatorDropdownValue>();
            var container = new DynamicContainer { Indicator = indicator };
            var cntrl = new ListBox { Name = "dynamicMulti" + indicator.Id.ToString(), Width = 220, Height = 100, Margin = new Padding(0, 5, 20, bottomPadding), SelectionMode = SelectionMode.MultiExtended };

            // Add the Control to the DynamicContainer for reference
            container.Control = cntrl;
            
            foreach (var v in dropdownKeys.Where(k => k.IndicatorId == indicator.Id).OrderBy(i => i.SortOrder))
            {
                cntrl.Items.Add(v);
                availableValues.Add(v);
            }
            cntrl.ValueMember = "Id";
            cntrl.DisplayMember = "DisplayName";
            if (!string.IsNullOrEmpty(val))
            {
                string[] vals = val.Split('|');
                cntrl.ClearSelected();
                foreach (var av in availableValues.Where(v => vals.Contains(v.TranslationKey)))
                    cntrl.SelectedItems.Add(av);
            }

            container.GetValue = () =>
            {
                List<string> selected = new List<string>();
                foreach (var i in cntrl.SelectedItems)
                    selected.Add((i as IndicatorDropdownValue).TranslationKey);
                return string.Join("|", selected.ToArray());
            };

            container.IsValid = () =>
            {
                if (indicator.IsRequired && indicatorErrors != null)
                {
                    if (string.IsNullOrEmpty(container.GetValue()))
                    {
                        indicatorErrors.SetError(cntrl, Translations.Required);
                        return false;
                    }
                    else
                        indicatorErrors.SetError(cntrl, "");
                }
                return true;
            };
            cntrl.Validating += (s, e) => { container.IsValid(); };

            controlList.Add(container);

            if (indicator.CanAddValues)
                return AddNewValLink(cntrl, indicator, entityType);
            else
                return cntrl;
        }
 public void HighlightPayDate(ListBox lb)
 {
     PleaseWait pw = new PleaseWait();
     pw.Show();
     Application.DoEvents();
     lb.ClearSelected();
     decimal totalDiv = 0;
     decimal quarterlyDiv = 0;
     int cnt = 0;
     string monthYear = "";
     string dtpMonthYear = "";
     string individualDivData = "";
     DataTable dt = DividendStocks.GetCurrentDividends();
     for (int i = 0; i < lb.Items.Count; i++)
     {
         DataRowView drv = lb.Items[i] as DataRowView;
         string[] date = drv["symbolName"].ToString().Split('*');
         string[] symbolSplit = date[0].Split('-');
         string symbol = symbolSplit[0].Trim();
         if (date.Length == 2)
         {
             monthYear = date[1].ToString();
             if (monthYear != "N/A")
             {
                 date = monthYear.Split('/');
                 monthYear = date[0].Trim() + "/" + date[2];
                 dtpMonthYear = dtpPayDate.Value.ToString("MM/yyyy");
                 //string dividendInterval = GetDividendInterval(Convert.ToInt32(drv["id"]), dt);
                 //if (dividendInterval == "Monthly")
                 //{
                 //    lb.SelectedIndices.Add(i);
                 //    totalDiv += GetDiv(Convert.ToInt32(drv["id"]), dt);
                 //    individualDivData += symbol + ": $" + Math.Round((GetDiv(Convert.ToInt32(drv["id"]), dt) / 4), 2) + "\n\n";
                 //}
                 if (monthYear == dtpMonthYear)
                 {
                     lb.SelectedIndices.Add(i);
                     totalDiv += GetDiv(Convert.ToInt32(drv["id"]), dt);
                     individualDivData += symbol + ": $" + Math.Round((GetDiv(Convert.ToInt32(drv["id"]), dt) / 4), 2) + "\n\n";
                     cnt++;
                 }
             }
         }
     }
     HighlightActive = false;
     quarterlyDiv = totalDiv / 4;
     pw.Close();
     if (cnt != 0)
     {
         MessageBox.Show(string.Format("{0} results\n\n" + "{1} \n\n" + individualDivData + "Total: ${2}\n\n", cnt, "Dividends for " + dtpMonthYear + ":",  Math.Round(quarterlyDiv, 2)));
     }
     else
     {
         MessageBox.Show(string.Format("No Results for {0}", dtpMonthYear));
     }
 }
 private void DeselectAll()
 {
     lstForHire.ClearSelected();
     lstCrew.ClearSelected();
 }
示例#24
0
 private void btnFilter(object sender, EventArgs e, ListBox lb, TextBox tb1, TextBox tb2, BindingList<string> lstDel, BindingList<string> lstAdd)
 {
     int[] arr = new int[lb.SelectedItems.Count];
     lb.SelectedIndices.CopyTo(arr, 0);
     for (int index = lb.SelectedItems.Count - 1; index >= 0; index--)
     {
         string item = (string)lb.Items[arr[index]];
         lstAdd.Add(item);
         lstDel.Remove(item);
     }
     FireEvent(tb1, "TextChanged", e);
     FireEvent(tb2, "TextChanged", e);
     lb.ClearSelected();
 }
示例#25
0
		private void disconnectDataSource()
		{			
			lstValores.ClearSelected();
			lstValores.DataSource = null;
		}
示例#26
0
        private void PopulateSPSites(Guid guidWebApp, ListBox listBoxSPSite)
        {
            //if (dictSPSite.Count > 0)
            //    dictSPSite.Clear();
            if (listBoxSPSite.Items.Count > 0)
                listBoxSPSite.Items.Clear();

            SPWebApplication objSPWebApp = SPWebService.ContentService.WebApplications[guidWebApp];
            foreach (SPSite objSPSite in objSPWebApp.Sites)
            {
                if (objSPSite.Url.EndsWith(@"Office_Viewing_Service_Cache"))
                    continue;

                //dictSPSite.Add(objSPSite.Url, string.Format("{0}, {1}", objSPSite.RootWeb.Title, objSPSite.Url));
                listBoxSPSite.Items.Add(new KeyValuePair<string, string>(objSPSite.Url, string.Format("{0}, {1}", objSPSite.RootWeb.Title, objSPSite.Url)));
            }

            //listBoxSPSite.DataSource = new BindingSource(dictSPSite, null);
            listBoxSPSite.DisplayMember = "Value";
            listBoxSPSite.ValueMember = "Key";

            listBoxSPSite.ClearSelected();

            textBoxPSScript.Text = string.Empty;
            _dictPSScriptBackup.Clear();
        }
 public void Highlight(ListBox lb, ComboBox ddl, Label lbl, bool showMsg)
 {
     lb.ClearSelected();
     decimal count = 0;
     decimal percentage = Convert.ToDecimal(lbl.Text);
     for (int i = 0; i < lb.Items.Count; i++)
     {
         DataRowView drv = lb.Items[i] as DataRowView;
         if (drv["symbolName"].ToString().Contains(ddl.Text))
         {
             count++;
             lb.SelectedIndices.Add(i);
         }
     }
     percentage = (count / percentage) * 100;
     HighlightActive = false;
     if (showMsg)
     {
         MessageBox.Show(count + " " + ddl.Text + ": " + Math.Round(percentage, 2) + "%");
     }
 }
示例#28
0
        /* add songs depending on album(s) selected */
        public void PopulateTracks(ListBox lb, string artist, string album)
        {
            lb.Items.Clear();
            lb.ClearSelected();
            XmlTrackList = GetTracks(artist, album);

            foreach (XElement el in XmlTrackList)
            {
                if(el.Element("Title").Value != null)
                    lb.Items.Add(el.Element("Title").Value);
            }
        }
 public void SearchSymbol(TextBox tb, ListBox lb)
 {
     bool selectedOne = false;
     lb.ClearSelected();
     for (int i = 0; i < lb.Items.Count; i++)
     {
         DataRowView drv = lb.Items[i] as DataRowView;
         if (drv["symbolName"].ToString().Contains(tb.Text.ToUpper()))
         {
             selectedOne = true;
             lb.SelectedIndices.Add(i);
         }
     }
     HighlightActive = false;
     if (!selectedOne)
     {
         MessageBox.Show("Not Found");
         tb.Clear();
     }
 }
 private void butNone_Click(object sender, System.EventArgs e)
 {
     listPayType.ClearSelected();
     checkBoxIns.Checked = false;
 }
示例#31
0
        /// <summary>
        /// Add the selected items from the specified source <c>ListBox</c> control to the specified destination <c>ListBox</c> control.
        /// </summary>
        /// <param name="listSource">The source <c>ListBox</c> control.</param>
        /// <param name="listDestination">the destination <c>ListBox</c> control.</param>
        protected override void Add(ref ListBox listSource, ref ListBox listDestination)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            int count = listSource.SelectedItems.Count;
            int currentIndex = listSource.SelectedIndex;

            // Skip, if no items have been selected.
            if (count == 0)
            {
                return;
            }

            if ((m_ListItemCount + count) > Parameter.SizeTestList)
            {
                MessageBox.Show(Resources.MBTSelfTestsMaxExceeded, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            Cursor = Cursors.WaitCursor;

            // ---------------------------------------------------------------------------------------
            // For each selected item: (a) add this to the destination list and update the added flag.
            // ---------------------------------------------------------------------------------------
            int selfTestIdentifier;
            for (int index = 0; index < count; ++index)
            {
                // Add the item to the destination list.
                listDestination.Items.Add(listSource.SelectedItems[index]);

                // Keep track of the number of tests that have been added to the test list.
                m_ListItemCount++;

                selfTestIdentifier = ((TestItem_t)listSource.SelectedItems[index]).SelfTestIdentifier;

                // Keep track of which watch variables have been removed.
                m_TestItems[selfTestIdentifier].Added = true;

                AddSupplementalFields(selfTestIdentifier);
            }

            UpdateCount();

            // Highlight the next item for processing if the list is not empty.
            if (listSource.Items.Count > 0)
            {
                // Bounds checking.
                if (currentIndex < listSource.Items.Count)
                {
                    listSource.SelectedIndex = currentIndex;
                }
                else if (currentIndex == listSource.Items.Count)
                {
                    listSource.SelectedIndex = currentIndex - 1;
                }
            }

            // Scroll to the end of the list.
            listDestination.SetSelected(listDestination.Items.Count - 1, true);
            listDestination.ClearSelected();

            m_ButtonApply.Enabled = true;
            OnDataUpdate(this, new EventArgs());
            Cursor = Cursors.Default;
        }
示例#32
0
 private void btnSelUNR_Click(object sender, System.EventArgs e)
 {
     lstDBTBL.ClearSelected();
 }
示例#33
0
        private void lstEscolher_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Back:
                if (incrementalText.Length > 0)
                {
                    incrementalText = incrementalText.Substring(0, incrementalText.Length - 1);
                }
                incrementalCandidate = char.MinValue;
                if (IncrementalSearchTextChanged != null)
                {
                    IncrementalSearchTextChanged(incrementalText);
                }
                e.Handled = true;
                break;

            case Keys.Up:
            case Keys.Down:
            case Keys.Left:
            case Keys.Right:
                ClearIncrementalText();
                break;

            default:
                if (incrementalCandidate != char.MinValue)
                {
                    incrementalText      = incrementalText + incrementalCandidate;
                    incrementalCandidate = char.MinValue;
                    if (IncrementalSearchTextChanged != null)
                    {
                        IncrementalSearchTextChanged(incrementalText);
                    }
                    //StatusBarIncrementalText.Text = incrementalText
                    e.Handled = true;
                }
                break;
            }

            if (e.Handled)
            {
                string[] Items = null;
                Items = new string[lstEscolher.Items.Count];
                lstEscolher.Items.CopyTo(Items, 0);

                int Position = System.Array.BinarySearch(Items, incrementalText, new DicionarioRowComparer());
                if (Position < 0)                 // Not found; hinting insertion point
                {
                    lstEscolher.ClearSelected();
                    if ((~Position) < lstEscolher.Items.Count)
                    {
                        lstEscolher.TopIndex      = (~Position);
                        lstEscolher.SelectedIndex = (~Position);
                    }
                    else
                    {
                        lstEscolher.TopIndex      = lstEscolher.Items.Count - 1;
                        lstEscolher.SelectedIndex = lstEscolher.Items.Count - 1;
                    }
                }
                else
                {
                    lstEscolher.SelectedIndex = Position;
                }
            }
        }
 public void HighlightAllNextToBuy(ListBox lb)
 {
     lb.ClearSelected();
     chkNextBuy.CheckedChanged -= chkNextBuy_CheckedChanged;
     chkNextBuy.Checked = true;
     chkNextBuy.CheckedChanged += chkNextBuy_CheckedChanged;
     int cnt = 0;
     DataTable dt = DividendStocks.GetAllNextToBuy(ID);
     for (int i = 0; i < lb.Items.Count; i++)
     {
         for (int a = 0; a < dt.Rows.Count; a++)
         {
             DataRowView drv = lb.Items[i] as DataRowView;
             if (drv["id"].Equals(dt.Rows[a]["id"]))
             {
                 cnt++;
                 lb.SelectedIndices.Add(i);
             }
         }
     }
     HighlightActive = false;
     MessageBox.Show(string.Format("{0} results.", cnt));
 }
示例#35
0
 public void AddLog(string Elem)
 {
     _lbMainLog.Items.Add(Elem);
     _lbMainLog.SelectedIndex = _lbMainLog.Items.Count - 1;
     _lbMainLog.ClearSelected();
 }
示例#36
0
文件: Form1.cs 项目: svn2github/eztx
 private void ShowMessage(ListBox listbox, string text)
 {
     if (listbox.InvokeRequired)
     {
         ShowMessageCallBack showmessageCallback = ShowMessage;
         listbox.Invoke(showmessageCallback, new object[] { listbox, text });
     }
     else
     {
         listbox.Items.Add(text);
         listbox.SelectedIndex = listbox.Items.Count - 1;
         listbox.ClearSelected();
     }
 }
 /// <summary>
 /// Event handler for Form::Load
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void WeatherItemSelectionDlg_Load(object sender, System.EventArgs e)
 {
     txtSelect.Text = "";
     lstWeatherItemNames.ClearSelected();
 }
示例#38
0
        public void SearchAllv5(string searchString, ListBox box, string searchType)
        {
            box.Invoke(new Action(() => box.ClearSelected()));
            string pattern = Regex.Escape(searchString).ToLower();

            if (searchString != string.Empty)
            {
                List<string> list = new List<string>();

                // KFreon: Hash search
                if (searchString.Length > 2 && searchString.Substring(0, 2) == "0x")
                {
                    for (int i = 0; i < texes.Count; i++)
                    {
                        TreeTexInfo tex = texes[i];
                        string thing = searchString.Substring(2).ToLowerInvariant();
                        string fromGame = KFreonLib.Textures.Methods.FormatTexmodHashAsString(tex.Hash).Substring(2).ToLowerInvariant();
                        if (fromGame.Contains(thing))
                            list.Add(tex.TexName + " (" + tex.ParentNode.Text.ToLower() + ")");
                    }
                }
                else if (searchString[0] == '@')   // KFreon: Export ID search
                {
                    int expID = 0;
                    if (!int.TryParse(searchString.Substring(1), out expID))
                        return;

                    for (int i = 0; i < texes.Count; i++)
                    {
                        TreeTexInfo tex = texes[i];
                        if (tex.ExpIDs.Contains(expID))
                            list.Add(tex.TexName + " (" + tex.ParentNode.Text.ToLower() + ")");
                    }
                }
                else if (searchString[0] == '\\')  // KFreon: Filename search
                {
                    int exppos = searchString.IndexOf('@');
                    int length = searchString.Length - (searchString.Length - exppos) - 2;
                    string name = (exppos == -1) ? searchString.Substring(1).ToLowerInvariant() : searchString.Substring(1, length).ToLowerInvariant();


                    if (exppos != -1)  // KFreon: Filename + ExpID search
                    {
                        int expID = 0;
                        if (!int.TryParse(searchString.Substring(exppos + 1), out expID))
                            return;

                        for (int i = 0; i < texes.Count; i++)
                        {
                            TreeTexInfo tex = texes[i];
                            for (int j = 0; j < tex.Files.Count; j++)
                                if (tex.Files[j].Split('\\').Last().ToLowerInvariant().Contains(name) && tex.ExpIDs[j] == expID)
                                    list.Add(tex.TexName + " (" + tex.ParentNode.Text.ToLower() + ")");
                        }
                    }
                    else  // KFreon: Normal filename search
                        for (int i = 0; i < texes.Count; i++)
                        {
                            TreeTexInfo tex = texes[i];
                            foreach (string filename in tex.Files)
                                if (filename.Split('\\').Last().ToLowerInvariant().Contains(name))
                                    list.Add(tex.TexName + " (" + tex.ParentNode.Text.ToLower() + ")");
                        }
                }
                else if (searchString[0] == '-')  // KFreon: Thumbnail search
                {
                    string searchstr = searchString.Substring(1).ToLowerInvariant();
                    foreach (TreeTexInfo tex in texes)
                    {
                        string name = Path.GetFileNameWithoutExtension(tex.ThumbnailPath).ToLowerInvariant();
                        if (name.Contains(searchstr))
                            list.Add(tex.TexName + " (" + tex.ParentNode.Text.ToLower() + ")");
                    }
                }
                else  // KFreon: Normal search
                {
                    for (int i = 0; i < texes.Count; i++)
                    {
                        TreeTexInfo tex = texes[i];
                        string name = tex.TexName + " (" + tex.ParentNode.Text.ToLower() + ")";
                        string s = name.ToLower();
                        Match match = Regex.Match(s, pattern, RegexOptions.IgnoreCase);
                        if (match.Success)
                            list.Add(s);
                    }
                }
                box.Invoke(new Action(() =>
                {
                    box.Items.Clear();
                    box.Items.AddRange(list.ToArray());
                }));
            }
        }
示例#39
0
 private void ClrListBox(ListBox ctl)
 {
     if(ctl.InvokeRequired)
       {
     ClrListBoxCallback d = new ClrListBoxCallback(ClrListBox);
     this.Invoke(d, new object[] { ctl });
       }
       else
       {
     ctl.ClearSelected();
       }
 }
示例#40
0
        private void move(ListBox box, List<string> files, List<string> fileNames, bool up)
        {
            ListBox.SelectedIndexCollection selection = box.SelectedIndices;
            List<int> indices = new List<int>();
            foreach (int s in selection)
                indices.Add(s);
            indices.Sort();

            int top = up ? 0 : files.Count - 1;
            for (int i = up ? 0 : indices.Count - 1; up ? i < indices.Count : i >= 0; i += up ? 1 : -1)
            {
                if (indices[i] == top)
                {
                    top += up ? 1 : -1;
                    continue;
                }

                int offset = up ? -1 : 1;
                string temp = files[indices[i] + offset];
                files[indices[i] + offset] = files[indices[i]];
                files[indices[i]] = temp;

                temp = fileNames[indices[i] + offset];
                fileNames[indices[i] + offset] = fileNames[indices[i]];
                fileNames[indices[i]] = temp;

                indices[i] += offset;
            }

            box.DataSource = null;
            box.DataSource = this.fullPathCheckBox.Checked ? files : fileNames;
            box.ClearSelected();
            foreach (int i in indices)
                box.SelectedIndex = i;
        }
        public static void addRemoveFields(ListBox listBoxToRemove, ListBox listBoxToAdd)
        {
            if (listBoxToRemove == null || listBoxToAdd == null)
            return;

             if (listBoxToRemove.SelectedItems.Count < 1)
             {
            return;
             }
             else
             {
            List<string> selTexts = new List<string>();
            listBoxToAdd.ClearSelected();
            foreach (object obj in listBoxToRemove.SelectedItems)
            {
               int nIndex = listBoxToAdd.Items.Add(obj);
               listBoxToAdd.SetSelected(nIndex, true);
               selTexts.Add(obj.ToString());
            }

            foreach (string selText in selTexts)
            {
               listBoxToRemove.Items.Remove(selText);
            }

            listBoxToRemove.ClearSelected();
             }
        }