Exemplo n.º 1
0
        private void collectBtn_Click(object sender, EventArgs e)
        {
            var              count = 0;
            Image            image;
            SqlOperate       opt = new SqlOperate();
            FileStream       stream;
            ListViewItemInfo item = null;
            var              list = opt.GetCollet();

            showImageList.Images.Clear();
            resultListView.Items.Clear();
            mainFrame.SelectedPageIndex = 0;
            m_exitLoad = true;

            foreach (var i in list)
            {
                stream          = new FileStream(i.ImagePath, FileMode.Open, FileAccess.Read);
                item            = new ListViewItemInfo();
                item.Text       = i.Name;
                item.ImageIndex = count++;
                item.ReferUrl   = i.Href;
                image           = Image.FromStream(stream);
                item.ConverImg  = image;

                showImageList.Images.Add(image);
                resultListView.Items.Add(item);
                stream.Close();
            }

            resultListView.LargeImageList = showImageList;
        }
Exemplo n.º 2
0
        private void collectBtn_Click(object sender, EventArgs e)
        {
            var          count = 0;
            Image        image;
            SqlOperate   opt = new SqlOperate();
            FileStream   stream;
            ListViewItem item = null;
            var          list = opt.GetCollet();

            showImageList.Images.Clear();
            resultListView.Items.Clear();
            mainFrame.SelectedPageIndex = 0;
            m_exitLoad = true;

            if (list.Count > 0)
            {
                resourse.SearchResultURL = new Dictionary <string, string>();
            }

            foreach (var i in list)
            {
                item            = new ListViewItem();
                item.Text       = i.Name;
                item.ImageIndex = count++;
                stream          = new FileStream(i.ImagePath, FileMode.Open, FileAccess.Read);
                image           = Image.FromStream(stream);
                showImageList.Images.Add(image);
                resultListView.Items.Add(item);
                stream.Close();

                if (resourse.SearchResultURL.ContainsKey(i.Name) == false)
                {
                    resourse.SearchResultURL.Add(i.Name, i.Href);
                }
            }

            resultListView.LargeImageList = showImageList;
        }