private void PopulateListView() { listViewFotos.View = View.LargeIcon; ImageList _images = new ImageList(); _images.ImageSize = new Size(192, 192); _images.ColorDepth = ColorDepth.Depth32Bit; foreach (string str in _Urls) { using (MemoryStream ms = new MemoryStream(Funcionalidades.GetImageAsByteArray(str))) { _images.Images.Add(Image.FromStream(ms)); } } listViewFotos.LargeImageList = _images; for (int j = 0; j < _images.Images.Count; j++) { ListViewItem item = new ListViewItem(); item.ImageIndex = j; listViewFotos.Items.Add(item); } }
private void SendUrlsToPicsForm() { IDataObject idat = null; Exception threadEx = null; String text = ""; Thread staThread = new Thread( delegate() { try { idat = Clipboard.GetDataObject(); text = idat.GetData(DataFormats.Text).ToString(); } catch (Exception ex) { threadEx = ex; } }); staThread.SetApartmentState(ApartmentState.STA); staThread.Start(); staThread.Join(); //Organizar Urls List <string> _Urls = new List <string>(); if (!String.IsNullOrEmpty(text)) { string Dados = Clipboard.GetText(TextDataFormat.Text).ToString(); if (flagAllurls) { _Urls = Funcionalidades.BuscarTodas(text); } else if (flagCheckG) { _Urls = Funcionalidades.BuscarUrls(text, flagCheckG); } else { _Urls = Funcionalidades.BuscarUrls(text, false); } } else { //Não existe nada no clipboard _Urls = null; } //Fechar este System.Threading.Thread.Sleep(1000); this.Invoke((MethodInvoker) delegate { if (_Urls == null) { return; } //Envia-las para o novo Pics Form Urls_ = _Urls; }); }