private void RestoreVideo() { // Get the UI set up correctly in the event there are no selected cameras ClearVideoBox(); foreach (FilterInfo fi in VideoCapability.SelectedCameras()) { int idx = clbCameras.Items.IndexOf(fi); clbCameras.SetItemChecked(idx, true); clbCameras.SetSelected(idx, true); } }
public void SetData(ITypeDescriptorContext context, IWindowsFormsEditorService editorService, string value) { m_editorService = editorService; chklstEnumValue.Visible = true; chklstEnumValue.Items.Clear(); List <string> strList = new List <string>(); strList.AddRange(Constans.ModalityValues); m_bNoFire = true; foreach (string strItem in strList) { string sName = strItem; chklstEnumValue.Items.Add(sName); } if (value == null) { value = "All"; } string sDelimitedValues = value; string[] arrValue = sDelimitedValues.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string sValue in arrValue) { string sTrimmedValue = sValue.Trim(); for (int i = 0; i < chklstEnumValue.Items.Count; i++) { string Name = (string)chklstEnumValue.Items[i]; //objItem; if (String.Compare(Name, sTrimmedValue, true) == 0) { CheckedListBox chk = (CheckedListBox)chklstEnumValue; chk.SetItemChecked(i, true); chklstEnumValue.SetSelected(i, true); break; } } } m_bNoFire = false; }
public void m_mthSetSelectedGroup(int p_intGroupID) { for (int i = 0; i < chklstGroup.Items.Count; i++) { if (((clsVitalGroup)chklstGroup.Items[i]).m_intGroupID == p_intGroupID) { chklstGroup.SetItemChecked(i, true); chklstGroup.SetSelected(i, true); chklstGroup_SelectedIndexChanged(null, null); break; } } m_mthDisplayGroupItem(p_intGroupID); }
/// <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 replaceToolStripMenuItem_Click(object sender, EventArgs e) { int index = lstTextures.SelectedIndex; if ((_selectedTexture != null) && (_selectedTexture.Source is TEX0Node)) { TEX0Node node = _selectedTexture.Source as TEX0Node; using (TextureConverterDialog dlg = new TextureConverterDialog()) if (dlg.ShowDialog(this, node) == DialogResult.OK) { _updating = true; _selectedTexture.Reload(); lstTextures.SetItemCheckState(index, CheckState.Checked); lstTextures.SetSelected(index, false); _updating = false; if (RenderStateChanged != null) { RenderStateChanged(this, null); } } } }
protected override void FillControls() { //para levantar if (_data != null) { System.Data.DataTable tableUsuarios = _data.Tables["sy_Usuarios"]; System.Data.DataTable tableUsuariosPerfiles = _data.Tables["sy_PerfilesUsuariosEmpresas"]; System.Data.DataRow rowUsuarios = tableUsuarios.Rows[0]; _idUsuario = (string)rowUsuarios["IdUsuario"]; _nombre = (string)rowUsuarios["Nombre"]; txtNombreUsuario.Text = _idUsuario; string clave = Convert.ToString(rowUsuarios["Clave"]); if (clave != null && !clave.Equals(string.Empty)) { clave = new mz.erp.security.dll.Encryption.Symmetric().DecryptStringBase64(clave); } uteConfirmaPassword.Text = clave; ultraTextEditor1.Text = clave; chkActivo.Checked = Convert.ToBoolean(rowUsuarios["Activo"]); /*foreach(System.Data.DataRow row in tableUsuariosPerfiles.Rows)//por cadausuario * { * for(int i=0; i < perfiles.Count; i++) //por cada item * { * Perfil p = (Perfil)perfiles[i]; * p.EstadoInicial= (Convert.ToInt64(p.IdPerfil) == (long)row["IdPerfil"]); //lo tilda segun si esta o no entre los perfiles * p.Tildado = p.EstadoInicial; * } * }*/ if (this.State.Equals("EDIT")) { this.equipo.Value = rowUsuarios["Equipo"]; foreach (System.Data.DataRow row in tableUsuariosPerfiles.Rows) //por cadausuario { string IdUsuario = Convert.ToString(row["IdUsuario"]); if (_idUsuario == IdUsuario) { for (int i = 0; i < perfiles.Count; i++) //por cada item { Perfil p = (Perfil)perfiles[i]; long IdPerfil1 = (long)row["IdPerfil"]; long IdPerfil2 = Convert.ToInt64(p.IdPerfil); if (IdPerfil1 == IdPerfil2) { p.EstadoInicial = true; p.Tildado = p.EstadoInicial; } } } } for (int i = 0; i < ListaPerfiles.Items.Count; i++) { Perfil p = (Perfil)perfiles[i]; ListaPerfiles.SetSelected(i, true); ListaPerfiles.SetItemChecked(i, p.Tildado); } //Cargo las secciones de las q son responsables _processItem = false; sy_UsuariosExDataset.tlg_ResponsablesDepositosSeccionesDataTable tableResponsablesSecciones = (sy_UsuariosExDataset.tlg_ResponsablesDepositosSeccionesDataTable)_data.Tables["tlg_ResponsablesDepositosSecciones"]; foreach (sy_UsuariosExDataset.tlg_ResponsablesDepositosSeccionesRow rowRS in tableResponsablesSecciones.Rows) { string IdSeccion = rowRS.IdSeccion; TreeNode nodeS = (TreeNode)nodesTree[IdSeccion]; foreach (TreeNode node in treeViewSecciones.Nodes) { int index = node.Nodes.IndexOf(nodeS); if (index != -1) { node.Nodes[index].Checked = true; } } } //si todas las secciones de un deposito estan seleccionadas selecciono el deposito this.seleccionarDeposito(); _processItem = true; } mzCmbPersona.DataValue = (string)rowUsuarios["IdPersona"]; this.ListaPerfiles.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.ListaPerfiles_ItemCheck); treeViewSecciones.AfterCheck += new TreeViewEventHandler(treeViewSecciones_AfterCheck); if (this.State.Equals("EDIT")) //Si es modificacion solo el propio usuario puede editar su contraseña. { ultraTextEditor1.Enabled = Security.IdUsuario.Equals(_idUsuario); uteConfirmaPassword.Enabled = Security.IdUsuario.Equals(_idUsuario); } else //Si es alta se puede ingresar una contraseña para el usuario q se esta creando solo si la variable asi lo indica. { ultraTextEditor1.Enabled = Variables.GetValueBool("Usuarios.Editar.Password"); uteConfirmaPassword.Enabled = Variables.GetValueBool("Usuarios.Editar.Password"); } mzCmbPersona.Enabled = Variables.GetValueBool("Usuarios.Editar.Persona"); txtNombreUsuario.Enabled = Variables.GetValueBool("Usuarios.Editar.NombreDeUsuario"); chkActivo.Enabled = Variables.GetValueBool("Usuarios.Editar.Activo"); equipo.Enabled = Variables.GetValueBool("Usuarios.Editar.Equipo"); ListaPerfiles.Enabled = Variables.GetValueBool("Usuarios.Editar.Perfiles"); treeViewSecciones.Enabled = Variables.GetValueBool("Usuarios.Editar.DepositosSecciones"); //Visibiliza y habilita las solapas de acuerdo a lo configurado en las variabes ultraExplorerBar1.Groups[0].Key = "DatosGenerales"; foreach (Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarGroup grupo in this.ultraExplorerBar1.Groups) { grupo.Visible = false; grupo.Container.Enabled = false; } string contenedoresVisibles = Variables.GetValueString("Usuarios.ContenedoresVisibles"); if (!contenedoresVisibles.Equals(string.Empty)) { ArrayList cont = mz.erp.systemframework.Util.Parse(contenedoresVisibles, ","); foreach (string grupo in cont) { if (this.ultraExplorerBar1.Groups.Exists(grupo)) { this.ultraExplorerBar1.Groups[grupo].Visible = true; } } } string contenedoresHabilitados = Variables.GetValueString("Usuarios.ContenedoresHabilitados"); if (!contenedoresHabilitados.Equals(string.Empty)) { ArrayList cont = mz.erp.systemframework.Util.Parse(contenedoresHabilitados, ","); foreach (string grupo in cont) { if (this.ultraExplorerBar1.Groups.Exists(grupo)) { if (this.ultraExplorerBar1.Groups[grupo].Container != null) { this.ultraExplorerBar1.Groups[grupo].Container.Enabled = true; } this.ultraExplorerBar1.Groups[grupo].Enabled = true; } } } } }
private void make_all(int num_of_drives) { comparision1st = false; clear_baseline(); int n = num_of_drives; int offx, offy, modd; int d = drives.Count; offx = 0; offy = 0; // make them on the run if (n > 12) { modd = 12; } else { modd = 4; } for (int i = 1; i <= n; i++) { CheckedListBox ata = new CheckedListBox(); Label lata = new Label(); ContextMenu mtt = new ContextMenu(); ContextMenuStrip mt = new ContextMenuStrip(); ata.Name = "ata" + i.ToString(); lata.Name = "lata" + i.ToString(); ata.Size = new Size(pref_w, pref_h); ata.Font = new Font(ata.Font.FontFamily, 7); ata.Location = new Point(pata_lx + offx, pata_ly + offy); lata.Height = pref_h; lata.Width = pref_w; lata.Location = new Point(plab_lx + offx, plab_ly + offy + 4); lata.Text = "Drive" + i.ToString(); for (int j = 0; j < d; j++) { ata.Items.Add(drives[j] + " GB", false); } ata.CheckOnClick = true; ata.SetSelected(0, false); ata.TabIndex = i + 4; ata.ContextMenuStrip = cms; this.Controls.Add(ata); this.Controls.Add(lata); ata.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(ata_ItemCheck); ata.MouseUp += new System.Windows.Forms.MouseEventHandler(ata_MouseUp); offx += pref_w + 10; if (((i % modd) == 0) & (i != 1)) { // first drive is 1 then 6th drive is 0 offx = 0; offy += 110; // that equals 133 } } int sw, sh, sw1, sh1; // get sizes after all controls besides the listbox are there to help size the listbox sw = this.PreferredSize.Width; sh = this.PreferredSize.Height; sw1 = 0; sh1 = 0; //ListBox lbr = new ListBox(); RichTextBox lbr = new RichTextBox(); lbr.Name = "lbr"; // lbr.HorizontalScrollbar = true; lbr.Size = new Size(sw - 25, 280); //used to be 390 then 350 then 280 lbr.Location = new Point(10, sh - 20); // lbr.ZoomFactor = 0.5;// convert.float(zoomfactor); lbr.Font = new Font(lbr.Font.FontFamily, fsizereg, lbr.Font.Style); this.Controls.Add(lbr); // resize the window sw1 = this.PreferredSize.Width; sh1 = this.PreferredSize.Height; this.Width = sw1 + 10; this.Height = sh1 + 5; numberofdrives = n; }
/// <summary> /// Check all items in a checked list box /// </summary> /// <param name="listBox">The checked list box to modify</param> private void CheckAllListboxItems(CheckedListBox listBox) { if (listBox.Items.Count <= 0) { return; } for (int listBoxIndex = 0; listBoxIndex < listBox.Items.Count; listBoxIndex++) { listBox.SetSelected(listBoxIndex, true); } }
public static void topSelection(CheckedListBox tab) { if (tab.SelectedIndex.ToString() != "-1") { bool etatItem = tab.GetItemChecked(tab.SelectedIndex); int index; string valeur; while (tab.SelectedIndex > 0) { valeur = tab.SelectedItem.ToString(); index = tab.SelectedIndex; tab.Items.RemoveAt(index); tab.Items.Insert(index - 1, valeur); tab.SetSelected(index - 1, true); } tab.SetItemChecked(tab.SelectedIndex, etatItem); } }
public static void diminueSelection(CheckedListBox tab) { if (tab.SelectedIndex.ToString() != "-1") { if (tab.SelectedIndex < tab.Items.Count - 1) { bool etatItem = tab.GetItemChecked(tab.SelectedIndex); string valeur = tab.SelectedItem.ToString(); int index = tab.SelectedIndex; tab.Items.RemoveAt(index); tab.Items.Insert(index + 1, valeur); tab.SetItemChecked(index + 1, etatItem); tab.SetSelected(index + 1, true); } } }
private void FilterListItem(CheckedListBox clb, string filter) { if (string.IsNullOrEmpty(filter)) return; ListItem li; for (int i = 0; i < clb.Items.Count; i++) { li = clb.Items[i] as ListItem; if (li.Value.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)) { clb.SetSelected(i, true); break; } } }
public static void limpiarCheckboxList(CheckedListBox cbl) { foreach (int i in cbl.CheckedIndices) { cbl.SetItemCheckState(i, CheckState.Unchecked); cbl.SetSelected(i,false); } }