private void RouteListView_DragEnter(object sender, DragEventArgs e) { try { if (e.Data.GetDataPresent(typeof(SelectedListViewItemCollection))) { if (this.auth != null) { SelectedListViewItemCollection c = (SelectedListViewItemCollection)e.Data.GetData(typeof(SelectedListViewItemCollection)); foreach (RouteListViewItem i in c) { if (i.auth.CompareTo(this.auth) != 0) { e.Effect = DragDropEffects.None; return; } } } e.Effect = DragDropEffects.Move; } else { e.Effect = DragDropEffects.None; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Shapeclustering(SelectedListViewItemCollection nodes) { string trArrayStr = ""; foreach (ListViewItem item in nodes) { string trName = $"{ Path.GetFileNameWithoutExtension(item.Text)}.tr"; if (File.Exists($"{this.tb_samplePath.Text}\\{trName}")) { trArrayStr += $"{trName} "; } } if (string.IsNullOrEmpty(trArrayStr)) { MessageBox.Show("没有检查到有任何tr文件", "生成shape文件"); return; } string command = $"shapeclustering -F font_properties -U unicharset {trArrayStr.TrimEnd()}"; var filePath = "proShape.bat"; ExeBat(command, filePath); //File.WriteAllText(filePath, command); //var pro = Process.Start(filePath); //pro.WaitForExit(); //var cmdResult = Utility.ExecCMD(command); //Console.WriteLine(cmdResult); this.lv_trainResult.Items.Add("shapetable"); //this.lv_trainResult.Items.Add("pffmtable"); MessageBox.Show("生成shape文件完成", "shapeclustering -F font_properties -U unicharset "); }
//private void exit_click(object sender, FormClosedEventArgs e) //{ // parentForm.Visible = false; // UserForm userForm = new UserForm(); // userForm.StartPosition = FormStartPosition.CenterParent; // userForm.Show(); //} private void listView_click(object sender, MouseEventArgs e) { ListView listview = (ListView)sender; SelectedListViewItemCollection col = listview.SelectedItems; selectOrder = col[0].SubItems[7].Text; }
private void Cntraining(SelectedListViewItemCollection nodes) { string trArrayStr = ""; foreach (ListViewItem item in nodes) { string trName = $"{ Path.GetFileNameWithoutExtension(item.Text)}.tr"; if (File.Exists($"{this.tb_samplePath.Text}\\{trName}")) { trArrayStr += $"{trName} "; } } if (string.IsNullOrEmpty(trArrayStr)) { MessageBox.Show("没有检查到有任何tr文件", "合并所有tr文件,cntraining"); return; } string command = $"cntraining {trArrayStr.TrimEnd()}"; var filePath = "proCntraining.bat"; ExeBat(command, filePath); //File.WriteAllText(filePath, command); //var pro = Process.Start(filePath); //pro.WaitForExit(); //var cmdResult = Utility.ExecCMD(command); //Console.WriteLine(cmdResult); //this.lv_trainResult.Items.Add("inttemp"); MessageBox.Show("合并所有tr文件", "Cntraining "); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button == MouseButtons.Left) { mLDown = false; } if (draggingItems) { draggingItems = false; if (drag) { this.ListViewItemSorter = null; SelectedListViewItemCollection selecteds = SelectedItems; if (dragIndex > selecteds[0].Index) { dragIndex--; } foreach (ListViewItem item in selecteds) { Items.Remove(item); Items.Insert(dragIndex, item); } OnOrderChanged(); } else { this.Invalidate(); } } }
private void button5_Click(object sender, EventArgs e) { SelectedListViewItemCollection fileItems = listView1.SelectedItems; SelectedListViewItemCollection userItems = listView2.SelectedItems; int fileItemsCount = fileItems.Count; int userItemsCount = userItems.Count; if (fileItemsCount > 0 && userItemsCount > 0) { GraphForm graphForm = new GraphForm(fileItems, userItems); graphForm.Show(); } else { if (fileItemsCount == 0 && userItemsCount == 0) { DialogWithOneButtom error = new DialogWithOneButtom(Сonstants.SelectUserAndFileError); error.ShowDialog(); } else if (userItemsCount == 0) { DialogWithOneButtom error = new DialogWithOneButtom(Сonstants.SelectUserError); error.ShowDialog(); } else { DialogWithOneButtom error = new DialogWithOneButtom(Сonstants.SelectFileError); error.ShowDialog(); } } }
private async void listView_DoubleClick(object sender, EventArgs e) { await StopProcesses(); SelectedListViewItemCollection itemCollection = listView.SelectedItems; ListViewFileItem item = (ListViewFileItem)itemCollection[0]; if (item.Attributes.HasFlag(FileAttributes.Directory)) { ChangeDirectory(item.Name); } else { try { fileOperator.OpenFile(item.Name); } catch (FileNotFoundException) { MessageBox.Show("File not found"); } catch (ObjectDisposedException) { MessageBox.Show("Failed to open file"); } catch (Win32Exception ex) { MessageBox.Show(ex.Message); } } }
/// <summary> /// drag complete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MyListView_DragDrop(object sender, DragEventArgs e) { int targetIndex = this.InsertionMark.Index; if (targetIndex == -1) { return; } SelectedListViewItemCollection draggedItems = (SelectedListViewItemCollection)e.Data.GetData(typeof(SelectedListViewItemCollection)); if (draggedItems == null || draggedItems.Count == 0 || draggedItems[0].ListView != this) { this.InsertionMark.Index = -1; return; } foreach (ListViewItem draggedItem in draggedItems) { this.Items.Remove(draggedItem); this.Items.Insert(targetIndex, draggedItem); if (AppearAboveItem(targetIndex)) { targetIndex++; } } OnItemDragSort?.Invoke(sender, e); }
/// <summary> /// Нажатие кнопок при активном списке со связью сигналов /// </summary> private void bindedSignalsList_KeyDown(object sender, KeyEventArgs e) { bool endEdit = e.KeyCode == Keys.Escape || e.KeyCode == Keys.Enter; if (endEdit) { ClearAllListViewsSelection(); e.Handled = true; } else if (e.KeyCode == Keys.Delete) { SelectedListViewItemCollection selectedItems = bindedSignalsList.SelectedItems; if (selectedItems != null && selectedItems.Count > 0) { ListViewItem selectedItem = selectedItems[0]; DeleteItemFromBindedSignals(selectedItem); } if (bindedSignalsList.Items.Count == 0) { ClearAllListViewsSelection(); } e.Handled = true; } }
private void ProductUniCharset(SelectedListViewItemCollection nodes) { string boxArrayStr = ""; foreach (ListViewItem item in nodes) { if (File.Exists($"{this.tb_samplePath.Text}\\{item.Text}")) { boxArrayStr += $"{item.Text} "; } } if (string.IsNullOrEmpty(boxArrayStr)) { MessageBox.Show("没有检查到有任何box文件", "抽取字符"); return; } CheckFont_properties(); string command = $"unicharset_extractor {boxArrayStr.TrimEnd()}"; var filePath = $"proChart.bat"; ExeBat(command, filePath); //File.WriteAllText(filePath, command); //var pro = Process.Start(filePath); //pro.WaitForExit(); //var cmdResult = Utility.ExecCMD(command); //Console.WriteLine(cmdResult); this.lv_trainResult.Items.Add("unicharset"); MessageBox.Show("从Box中抽取字符完成"); }
public BaseListGrid() : base() { Items = new ListGridItemCollection(this); Columns = new ListGridColumnHeaderCollection(this); SelectedItems = new SelectedListViewItemCollection(this); CheckedItems = new CheckedListViewItemCollection(this); }
private void MyListView_DragEnter(object sender, DragEventArgs e) { GroupSelectedSataus.GetSnapshoot(); OnItemDragSortStart?.Invoke(sender, null); GroupSelectedSataus.ReCoverSnapshoot(); SelectedListViewItemCollection draggedItems = (SelectedListViewItemCollection)e.Data.GetData(typeof(SelectedListViewItemCollection)); e.Effect = (draggedItems == null || draggedItems.Count == 0 || draggedItems[0].ListView != this) ? DragDropEffects.None : e.AllowedEffect; }
private void lsvCourse_ItemActivate(object sender, EventArgs e) { SelectedListViewItemCollection list = ((ListView)sender).SelectedItems; if (list.Count == 0) { return; } list[0].Checked = !list[0].Checked; }
public String toStringa(SelectedListViewItemCollection slvic) { String result = ""; foreach (ListViewItem lvi in slvic) { result += lvi.Text + " "; } return(result); }
private void listView1_ItemActivate(object sender, EventArgs e) { SelectedListViewItemCollection list = (sender as ListView).SelectedItems; if (list.Count == 0) { return; } list[0].Checked = list[0].Checked ? false : true; }
//load the selected Transaction from DB and display it private void listView_SelectedIndexChanged(object sender, EventArgs e) { SelectedListViewItemCollection items = listView.SelectedItems; if (items.Count > 0) { int index = Int32.Parse(items[0].Text); tr = getTransactionFromDB(index); fillForm(); } }
private List <string> getSelectedFiles( SelectedListViewItemCollection items) { List <string> fileNames = new List <string>(items.Count); foreach (ListViewItem item in items) { fileNames.Add(item.SubItems[0].Text); } return(fileNames); }
public ListView () { background_color = Color.White;//ThemeEngine.Current.ColorWindow; groups = new ListViewGroupCollection (this); items = new ListViewItemCollection (this); items.Changed += new CollectionChangedHandler (OnItemsChanged); checked_indices = new CheckedIndexCollection (this); checked_items = new CheckedListViewItemCollection (this); columns = new ColumnHeaderCollection (this); foreground_color = SystemColors.WindowText; selected_indices = new SelectedIndexCollection (this); selected_items = new SelectedListViewItemCollection (this); items_location = new Point [16]; items_matrix_location = new ItemMatrixLocation [16]; reordered_items_indices = new int [16]; item_tooltip = new ToolTip (); item_tooltip.Active = false; insertion_mark = new ListViewInsertionMark (this); InternalBorderStyle = BorderStyle.Fixed3D; header_control = new HeaderControl (this); header_control.Visible = false; Controls.AddImplicit (header_control); item_control = new ItemControl (this); Controls.AddImplicit (item_control); h_marker = v_marker = 0; keysearch_tickcnt = 0; // scroll bars are disabled initially h_scroll.Visible = false; //h_scroll.ValueChanged += new EventHandler(HorizontalScroller); v_scroll.Visible = false; //v_scroll.ValueChanged += new EventHandler(VerticalScroller); // event handlers base.KeyDown += new KeyEventHandler(ListView_KeyDown); SizeChanged += new EventHandler (ListView_SizeChanged); //GotFocus += new EventHandler (FocusChanged); //LostFocus += new EventHandler (FocusChanged); //MouseWheel += new MouseEventHandler(ListView_MouseWheel); //MouseEnter += new EventHandler (ListView_MouseEnter); Invalidated += new InvalidateEventHandler (ListView_Invalidated); BackgroundImageTiled = false; this.SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick | ControlStyles.UseTextForAccessibility , false); }
public GraphForm(SelectedListViewItemCollection fileItems, SelectedListViewItemCollection entityItems) { XmlConfigurator.Configure(); InitializeComponent(); AccessMatrixController controller = new AccessMatrixController(fileItems, entityItems); this.accessMatrix = getAccessMatrix(controller.AccessMatrix); this.graphVertexs = controller.GraphVertexs; addWarningMessages(controller.WarningMessages); }
private void ClearSelections() { this._selectionsBeingCleared = true; SelectedListViewItemCollection itemsToDeselect = this.SelectedItems; foreach (ListViewItem item in itemsToDeselect.Cast <ListViewItem>().Skip(1)) { item.Selected = false; } this._selectionsBeingCleared = false; this.SelectedItems.Clear(); }
/// <summary> /// Событие изменения выбранного элемента в списке сигналов /// текущего проекта /// </summary> private void currentProjSignalsList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { string currentProjectDevice = e.Item.SubItems[1].Text; SelectedListViewItemCollection advancedProjectDevices = advancedProjSignalsList.SelectedItems; bool needChange = (currentProjectDevice != null && advancedProjectDevices.Count != 0 && e.IsSelected); if (!needChange) { return; } bool needAddNewElement = bindedSignalsList.SelectedItems .Count == 0; if (needAddNewElement) { ListViewItem advancedProjectDevice = advancedProjectDevices[0]; AddToBindedSignals(e.Item.Tag.ToString(), currentProjectDevice, advancedProjectDevice.Tag.ToString(), advancedProjectDevice.Text); } else { var selectedRow = bindedSignalsList.SelectedItems[0]; if (selectedRow != null) { bool mainProject = true; string groupName = selectedRow.Group.Name; bool success = interprojectExchange.UpdateProjectBinding( groupName, selectedRow.SubItems[0].Text, currentProjectDevice, mainProject); if (success) { selectedRow.SubItems[0].Text = currentProjectDevice; } else { ShowErrorMessage("Ошибка изменения связи"); } } } }
/// <summary> /// Событие изменения выбранного элемента в списке сигналов /// текущего проекта /// </summary> private void currentProjSignalsList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { string currProjDev = e.Item.SubItems[1].Text; SelectedListViewItemCollection advProjDevs = advancedProjSignalsList.SelectedItems; bool needChange = (currProjDev != null && advProjDevs.Count != 0 && e.IsSelected); if (!needChange) { return; } bool needAddNewElement = bindedSignalsList.SelectedItems.Count == 0; if (needAddNewElement) { string currProjDevType = e.Item.Tag.ToString(); string advProjDev = advProjDevs[0].SubItems[0].Text; string advProjDevType = advProjDevs[0].Tag.ToString(); AddToBindedSignals(currProjDevType, currProjDev, advProjDevType, advProjDev); } else { var selectedRow = bindedSignalsList.SelectedItems[0]; bool notIgnoreEdit = !filterConfiguration.HideBindedSignals; if (selectedRow != null && notIgnoreEdit) { bool mainProject = true; string groupName = selectedRow.Group.Name; bool success = interprojectExchange.UpdateProjectBinding( groupName, selectedRow.SubItems[0].Text, currProjDev, mainProject, out bool needSwap); if (success) { ReplaceSignal(needSwap, currProjDev, selectedRow, 0); } else { ShowErrorMessage("Ошибка изменения связи"); } } } }
private List <UserEntity> getSelectedUsers(SelectedListViewItemCollection items) { List <UserEntity> selectedUsers = new List <UserEntity>(items.Count); foreach (ListViewItem item in items) { selectedUsers.Add( new UserEntity( item.SubItems[0].Text, item.SubItems[1].Text, getGroupNames( item.SubItems[2].Text.Split(Сonstants.CommaSplitSymbolChar)) ) ); } return(selectedUsers); }
private void References_Clicked(object sender, EventArgs e) { SelectedListViewItemCollection items = lstVw_References.SelectedItems; if (items.Count > 1) { return; } if (Uri.TryCreate(items[0].SubItems["reference"].Text, UriKind.RelativeOrAbsolute, out Uri result)) { DialogResult open = MessageBox.Show("It looks like you selected an URL, would you like to open it?", "Open URL", MessageBoxButtons.YesNoCancel); if (open == DialogResult.Yes) { System.Diagnostics.Process.Start(result.ToString()); } } }
private void RouteListView_DragDrop(object sender, DragEventArgs e) { SelectedListViewItemCollection c = (SelectedListViewItemCollection)e.Data.GetData(typeof(SelectedListViewItemCollection)); foreach (RouteListViewItem i in c) { try { i.Remove(); Add(i); } catch (Exception ex) { MessageBox.Show(ex.Message); } } Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); //Sort(); e.Effect = DragDropEffects.Move; }
private void ItemDoubleClick(object sender, EventArgs e) { SelectedListViewItemCollection items = fileListView.SelectedItems; if (items.Count > 0) { ListViewItem item = items[0]; model.FileInfo fileInfo = (model.FileInfo)item.Tag; if (fileInfo.isDirectory) { LoadFiles(fileInfo.fullname); } else { DownloadFile(fileInfo.fullname); } } }
/// <summary> /// Нажатие кнопок при активном списке со связью сигналов /// </summary> private void bindedSignalsList_KeyDown(object sender, KeyEventArgs e) { SelectedListViewItemCollection selectedItems = bindedSignalsList.SelectedItems; ListViewItem selectedItem; if (selectedItems?.Count > 0) { selectedItem = selectedItems[0]; } else { return; } bool endEdit = e.KeyCode == Keys.Escape || e.KeyCode == Keys.Enter; if (endEdit) { ClearAllListViewsSelection(); e.Handled = true; } else if (e.KeyCode == Keys.Delete) { DeleteItemFromBindedSignals(selectedItem); if (bindedSignalsList.Items.Count == 0) { ClearAllListViewsSelection(); e.Handled = true; } } else if (e.KeyCode == Keys.Up && e.Shift) { MoveInGroup(selectedItem, MoveDirection.UP); e.Handled = true; } else if (e.KeyCode == Keys.Down && e.Shift) { MoveInGroup(selectedItem, MoveDirection.DOWN); e.Handled = true; } }
private void listView_click(object sender, EventArgs e) { ListView listView = (ListView)sender; SelectedListViewItemCollection col = listView.SelectedItems; ListViewItem item = col[0]; //MessageBox.Show(item.SubItems[0].Text + "선택"); // form 초기화 if (targetForm != null) { targetForm.Dispose(); } targetForm = new AnswerForm(Convert.ToInt32(item.SubItems[0].Text)); targetForm.StartPosition = parentForm.StartPosition; // form 호출 targetForm.ShowDialog(); getList(); }
private void lstContact_Click(object sender, EventArgs e) { //khai báo biến chuỗi chứa thông tin khi chọn 1 liên hệ SelectedListViewItemCollection collection = lstContact.SelectedItems; //nếu có liên hệ được chọn thì lấy thông tin chi tiết if (collection.Count > 0) { //hiển thị thông tin chi tiết frmEdit form2 = new frmEdit(); form2.collection = collection; form2.ShowDialog(); lstContact.SelectedItems[0].Text = form2.collection[0].Text; lstContact.SelectedItems[0].SubItems[1].Text = form2.collection[0].SubItems[1].Text; lstContact.SelectedItems[0].SubItems[2].Text = form2.collection[0].SubItems[2].Text; lstContact.SelectedItems[0].SubItems[3].Text = form2.collection[0].SubItems[3].Text; } }
private bool 이행() { try { MessageBox.Show("이행"); SelectedListViewItemCollection col = listView1.SelectedItems; for (int i = 0; i < col.Count; i++) { ListViewItem item = col[i]; MessageBox.Show(item.SubItems[1].Text); ArrayList list = Table_Select(item.SubItems[1].Text); } return(true); } catch { return(false); } }
private void RemoveEmbeddedControls(SelectedListViewItemCollection selectedItems) { foreach (ListViewItem item in selectedItems) { int idx = 0; do { EmbeddedControl ec = this._embeddedControls[idx]; if (ec.Item == item) { this._embeddedControls.RemoveAt(idx); } else { idx++; } } while (idx < this._embeddedControls.Count); } }
private void MoveItems(SelectedListViewItemCollection items, DragEventArgs drgevent) { if (items.Count == 0) return; Point cp = PointToClient(new Point(drgevent.X, drgevent.Y)); ListViewItem dragToItem = GetItemAt(cp.X, cp.Y); if (dragToItem == null) return; int dragIndex = dragToItem.Index; Spectrum spectrumDragIdx = collection[dragToItem.ImageIndex]; List<Spectrum> tmp = new List<Spectrum>(); foreach (ListViewItem lvi in items) tmp.Add(collection[lvi.ImageIndex]); foreach (Spectrum spec in tmp) collection.Remove(spec); int idx = collection.GetIndex(spectrumDragIdx); foreach (Spectrum spec in tmp) collection.Spectra.Insert(idx, spec); InvalidateCollection(); }