当前位置: 首页>>代码示例>>C#>>正文


C# ListView.Refresh方法代码示例

本文整理汇总了C#中System.Windows.Forms.ListView.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.Refresh方法的具体用法?C# ListView.Refresh怎么用?C# ListView.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ListView的用法示例。


在下文中一共展示了ListView.Refresh方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ListViewClear

 /// <summary>
 /// Clears and refreshes the contents of the file view.
 /// </summary>
 public void ListViewClear(ListView listView)
 {
     listView.Items.Clear();
     listView.Refresh();
 }
开发者ID:Revelations,项目名称:BaconApp,代码行数:8,代码来源:FeedbackPresenter.cs

示例2: RenderDatabaseHistory

        internal void RenderDatabaseHistory(string dbPath, ListView dbContentListView)
        {
            var history = new PersistanceManager.SqLitePersistanceManager(dbPath).GetFullHistory();

            dbContentListView.Items.Clear();
            dbContentListView.View = View.Details;

            foreach (var historyItem in history)
            {
                var startTime = historyItem.StartTime.ToString();
                var endTime = historyItem.StartTime.ToString();
                var files = Convert.ToString(historyItem.ProcessedFilesCount);
                var searchPhrases = String.Join(" ", historyItem.Phrases);

                var listItem = new ListViewItem(new[] { startTime, endTime, files, searchPhrases });

                listItem.Tag = new SearchResultAdapter(historyItem);

                dbContentListView.Items.Add(listItem);
            }

            dbContentListView.Refresh();
        }
开发者ID:kzemek,项目名称:FileScanner,代码行数:23,代码来源:MainWindow.cs

示例3: ClearTiles

        public static void ClearTiles(D2DMapEditor d2d, Map map, ref Tile[] tileLibrary, ListView lvTileLibrary, ImageList ilTileImages)
        {
            // clear all tiles in the tile library
            // delete all controls
            lvTileLibrary.Items.Clear();
            //ilTileImages.Images.Clear();

            if (tileLibrary != null)
            {
                Array.Clear(tileLibrary, 0, tileLibrary.Length);
                Array.Resize(ref tileLibrary, 0);
            }

            // initialized map
            foreach (Layer layer in map.Layers)
                for (int x = 0; x < layer.Width; x++)
                    for (int y = 0; y < layer.Height; y++)
                        layer.LayerData[x, y] = -1;

            lvTileLibrary.Refresh();
            d2d.ClearSelectedTile();
        }
开发者ID:Nacheon,项目名称:2D-Map-Tool-using-C-,代码行数:22,代码来源:TilesManagement.cs

示例4: SetIconSpacing

        public static void SetIconSpacing(ListView ListView,int Height, int Width)
        {
            SendMessage(ListView.Handle, LVM_SETICONSPACING, 0, Width * 65536 + Height);

            ListView.Refresh();
        }
开发者ID:MetalMynds,项目名称:FlatGlass,代码行数:6,代码来源:ListViewHelper.cs

示例5: AddTiles

        public static void AddTiles(D2DMapEditor d2d, Map map, ref Tile[] tileLibrary, ListView lvTileLibrary, ImageList ilTileImages, string folderName)
        {
            // add tiles to tile library
            ArrayList tilesArrayList = new ArrayList();

            Cursor.Current = Cursors.WaitCursor;

            foreach (string f in Directory.GetFiles(folderName))
            {   // load tiles
                if (Path.GetExtension(f) == ".bmp" || Path.GetExtension(f) == ".jpg" || Path.GetExtension(f) == ".gif" || Path.GetExtension(f) == ".png")
                    tilesArrayList.Add(f.ToString());
            }

            // delete all controls
            //lvTileLibrary.Controls.Clear();
            //lvTileLibrary.Refresh();

            int t = 0;

            // resize tileLibrary
            if (tileLibrary != null && tileLibrary.Length > 0)
            {   // add to the library
                t = tileLibrary.Length;
                Array.Resize(ref tileLibrary, tilesArrayList.Count + tileLibrary.Length);
            }
            else
            {   // load new library
                Array.Resize(ref tileLibrary, tilesArrayList.Count);
            }

            PictureBox pB = null;
            ListViewItem item = null;

            foreach (string i in tilesArrayList)
            {   // update tiles library
                Tile newTile = new Tile();
                pB = new PictureBox();
                pB.Width = map.TileWidth;
                pB.Height = map.TileHeight;
                pB.Name = t.ToString();
                pB.Load(i);
                newTile.TileID = t;
                newTile.TileName = t.ToString();
                newTile.TilePictureBox = pB;
                tileLibrary[t] = newTile;

                ilTileImages.Images.Add(pB.Image);

                item = new ListViewItem();
                item.ImageIndex = t;
                lvTileLibrary.Items.Add(item);

                t++;
            }

            if (pB != null)
            {
                ilTileImages.ImageSize = new Size(pB.Width, pB.Height);
                lvTileLibrary.TileSize = new Size(ilTileImages.ImageSize.Width + TileMargin, ilTileImages.ImageSize.Height + TileMargin);
            }

            lvTileLibrary.LargeImageList = ilTileImages;

            lvTileLibrary.MouseClick += new MouseEventHandler(d2d.tilePicBox_MouseClick);

            lvTileLibrary.Refresh();
            //RenderTiles(map, ref tileLibrary, lvTileLibrary);

            Cursor.Current = Cursors.Default;
        }
开发者ID:Nacheon,项目名称:2D-Map-Tool-using-C-,代码行数:70,代码来源:TilesManagement.cs

示例6: RenderTiles

        public static void RenderTiles(Map map, ref Tile[] tileLibrary, ListView lvTileLibrary)
        {
            // render tiles in the tile library panel
            lvTileLibrary.Controls.Clear();
            ImageList ilTileImages = new ImageList();

            PictureBox pb = null;
            ListViewItem item = null;
            if (tileLibrary != null)
            {
                for (int i = 0; i < tileLibrary.Length; i++)
                {   // reload tiles panel
                    pb = tileLibrary[i].TilePictureBox;
                    pb.SizeMode = PictureBoxSizeMode.StretchImage;

                    if (pb != null)
                    {
                        pb.Width = map.TileWidth;
                        pb.Height = map.TileHeight;
                        pb.Name = i.ToString();

                        ilTileImages.Images.Add(pb.Image);

                        item = new ListViewItem();
                        item.ImageIndex = i;
                        lvTileLibrary.Items.Add(item);
                    }
                }

                if (pb != null)
                {
                    ilTileImages.ImageSize = new Size(pb.Width, pb.Height);
                    lvTileLibrary.TileSize = new Size(ilTileImages.ImageSize.Width + TileMargin, ilTileImages.ImageSize.Height + TileMargin);
                }

                lvTileLibrary.LargeImageList = ilTileImages;
            }

            lvTileLibrary.Refresh();
        }
开发者ID:Nacheon,项目名称:2D-Map-Tool-using-C-,代码行数:40,代码来源:TilesManagement.cs

示例7: LoadTiles

        public static void LoadTiles(D2DMapEditor d2d, Map map, ref Tile[] tileLibrary, ListView lvTileLibrary, ImageList ilTileImages, string fileName)
        {
            // load tiles from the saved tile library
            // clear tile library
            if (tileLibrary != null)
                Array.Clear(tileLibrary, 0, tileLibrary.Length);

            // load tiles
            ///////////////
            string pbDirName = Path.GetDirectoryName(fileName) + "\\" + Path.GetFileNameWithoutExtension(fileName);

            ArrayList tilesArrayList = new ArrayList();

            // delete all controls
            lvTileLibrary.Controls.Clear();
            lvTileLibrary.Refresh();

            if (Directory.Exists(pbDirName))
            {
                foreach (string f in Directory.GetFiles(pbDirName))
                {   // load tiles
                    if (Path.GetExtension(f) == ".bmp" || Path.GetExtension(f) == ".jpg" || Path.GetExtension(f) == ".gif" || Path.GetExtension(f) == ".png")
                        tilesArrayList.Add(f.ToString());
                }

                int t = 0;

                // resize tileLibrary
                Array.Resize(ref tileLibrary, tilesArrayList.Count);

                PictureBox pB = null;
                ListViewItem item = null;

                foreach (string i in tilesArrayList)
                {   // update tiles library
                    Tile newTile = new Tile();
                    pB = new PictureBox();
                    pB.Width = map.TileWidth;
                    pB.Height = map.TileHeight;
                    pB.Name = t.ToString();
                    pB.Load(i);
                    newTile.TileID = t;
                    newTile.TileName = t.ToString();
                    newTile.TilePictureBox = pB;
                    tileLibrary[t] = newTile;

                    ilTileImages.Images.Add(pB.Image);

                    item = new ListViewItem();
                    item.ImageIndex = t;
                    lvTileLibrary.Items.Add(item);

                    t++;
                }

                if (pB != null)
                {
                    ilTileImages.ImageSize = new Size(pB.Width, pB.Height);
                    lvTileLibrary.TileSize = new Size(ilTileImages.ImageSize.Width + TileMargin, ilTileImages.ImageSize.Height + TileMargin);
                }

                lvTileLibrary.LargeImageList = ilTileImages;

                lvTileLibrary.MouseClick += new MouseEventHandler(d2d.tilePicBox_MouseClick);

                lvTileLibrary.Refresh();
            }
            else
            {
                MessageBox.Show(pbDirName + " doesn't exist! This folder is needed for the Tiles Library.", "Cannot Find Folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            string tileLibraryFileName = Path.GetDirectoryName(fileName) + "\\" + Path.GetFileNameWithoutExtension(fileName) + "-tile.xml";
            FileStream tfs = new FileStream(tileLibraryFileName, FileMode.Open);
            XmlDocument tr = new XmlDocument();
            tr.Load(tfs);

            XmlNodeList tileList = tr.GetElementsByTagName("Tile");

            foreach (XmlNode node in tileList)
            {
                XmlElement tileElement = (XmlElement)node;

                int tileID = Convert.ToInt32(tileElement.Attributes["ID"].InnerText);

                tileLibrary[tileID].TileName = tileElement.GetElementsByTagName("Name")[0].InnerText;
                tileLibrary[tileID].TileWidth = Convert.ToInt32(tileElement.GetElementsByTagName("Width")[0].InnerText);
                tileLibrary[tileID].TileHeight = Convert.ToInt32(tileElement.GetElementsByTagName("Height")[0].InnerText);
                tileLibrary[tileID].TileWalkable = Convert.ToBoolean(tileElement.GetElementsByTagName("Walkable")[0].InnerText);
                tileLibrary[tileID].Type = Convert.ToInt32(tileElement.GetElementsByTagName("Type")[0].InnerText);
            }

            tfs.Close();
        }
开发者ID:Nacheon,项目名称:2D-Map-Tool-using-C-,代码行数:94,代码来源:TilesManagement.cs

示例8: DeleteSelectedTile

        public static void DeleteSelectedTile(D2DMapEditor d2d, Map map, ref Tile[] tileLibrary, ListView lvTileLibrary, ImageList ilTileImages, int selectedTileID)
        {
            // remove selected tile from tile library
            if (tileLibrary != null)
            {   // remove that tile
                int i = 0;
                for (i = selectedTileID; i < tileLibrary.Length - 1; i++)
                {
                    tileLibrary[i].TileWidth = tileLibrary[i + 1].TileWidth;
                    tileLibrary[i].TileHeight = tileLibrary[i + 1].TileHeight;
                    tileLibrary[i].TilePath = tileLibrary[i + 1].TilePath;
                    tileLibrary[i].TileWalkable = tileLibrary[i + 1].TileWalkable;
                    tileLibrary[i].TilePictureBox = tileLibrary[i + 1].TilePictureBox;
                    tileLibrary[i].TilePictureBox.Name = tileLibrary[i].TileName;

                    //if (tileLibrary[i + 1].TileName == tileLibrary[i + 1].TileID.ToString())
                    //    tileLibrary[i].TileName = tileLibrary[i].TileID.ToString();
                    //else
                    //    tileLibrary[i].TileName = tileLibrary[i + 1].TileName;

                    //tileLibrary[i].TileID = i;
                }
                Array.Clear(tileLibrary, i, 1);
                Array.Resize(ref tileLibrary, tileLibrary.Length - 1);

                //ilTileImages.Images.RemoveAt(selectedTileID);
                lvTileLibrary.Items.RemoveAt(selectedTileID);
            }

            // update map
            foreach (Layer layer in map.Layers)
            {
                for (int x = 0; x < layer.Width; x++)
                {
                    for (int y = 0; y < layer.Height; y++)
                    {
                        if (layer.LayerData[x, y] == selectedTileID)
                        {
                            layer.LayerData[x, y] = -1;
                        }
                        else if (layer.LayerData[x, y] > selectedTileID)
                        {
                            layer.LayerData[x, y] = layer.LayerData[x, y] - 1;
                        }
                    }
                }
            }

            //RenderTiles(map, ref tileLibrary, lvTileLibrary);
            lvTileLibrary.Refresh();
            d2d.RenderMap();
            d2d.ClearSelectedTile();
        }
开发者ID:Nacheon,项目名称:2D-Map-Tool-using-C-,代码行数:53,代码来源:TilesManagement.cs

示例9: MoveListViewItem

        //Pulled from http://www.knowdotnet.com/articles/listviewmoveitem.html
        private void MoveListViewItem(ref ListView lv, bool moveUp)
        {
            string cache;
            int selIdx;
            bool itemchecked = false;
            bool otheritemchecked = false;

            selIdx = lv.SelectedItems[0].Index;
            if (lv.Items[selIdx].Checked) { itemchecked = true; }
            if (moveUp)
            {
                if (lv.Items[selIdx - 1].Checked) { otheritemchecked = true; }
                // ignore moveup of row(0)
                if (selIdx == 0)
                    return;

                // move the subitems for the previous row
                // to cache to make room for the selected row
                for (int i = 0; i < lv.Items[selIdx].SubItems.Count; i++)
                {
                    cache = lv.Items[selIdx - 1].SubItems[i].Text;
                    lv.Items[selIdx - 1].SubItems[i].Text =
                      lv.Items[selIdx].SubItems[i].Text;
                    lv.Items[selIdx].SubItems[i].Text = cache;
                }
                lv.Items[selIdx - 1].Selected = true;
                if (itemchecked) { lv.Items[selIdx - 1].Checked = true; } else { lv.Items[selIdx - 1].Checked = false; }
                if (otheritemchecked)
                {
                    lv.Items[selIdx].Checked = true;
                }
                else
                {
                    lv.Items[selIdx].Checked = false;
                }
                lv.Refresh();
                lv.Focus();
            }
            else
            {
                if (lv.Items[selIdx + 1].Checked) { otheritemchecked = true; }
                // ignore movedown of last item
                if (selIdx == lv.Items.Count - 1)
                    return;
                // move the subitems for the next row
                // to cache so we can move the selected row down
                for (int i = 0; i < lv.Items[selIdx].SubItems.Count; i++)
                {
                    cache = lv.Items[selIdx + 1].SubItems[i].Text;
                    lv.Items[selIdx + 1].SubItems[i].Text =
                      lv.Items[selIdx].SubItems[i].Text;
                    lv.Items[selIdx].SubItems[i].Text = cache;
                }
                lv.Items[selIdx + 1].Selected = true;
                if (itemchecked) { lv.Items[selIdx + 1].Checked = true; } else { lv.Items[selIdx + 1].Checked = false; }
                if (otheritemchecked)
                {
                    lv.Items[selIdx].Checked = true;
                }
                else
                {
                    lv.Items[selIdx].Checked = false;
                }
                lv.Refresh();
                lv.Focus();
            }
        }
开发者ID:jesusspork,项目名称:Xenix,代码行数:68,代码来源:AccountForm.cs

示例10: buttonLoadFromArchive_Click

        private void buttonLoadFromArchive_Click(object sender, EventArgs e)
        {
            var form1 = new Form()
                            {
                                RightToLeft = RightToLeft.Yes,
                                RightToLeftLayout = true,
                                Height = 500,
                                Width = 700,
                                Name = String.Format(comboBox1.SelectedText + "רשימת תמונות מקטגוריה")
            };
            var listView = new ListView
            {
                View = View.Details,
                GridLines = true,
                FullRowSelect = true,
                CheckBoxes = false,
                AllowColumnReorder = true,
                LabelEdit = false,
                RightToLeftLayout = true,
                MultiSelect = false,
                Dock = DockStyle.Fill,
                Visible = true
            };

            listView.DoubleClick += SelectPhotoDoubleClick;

            listView.Columns.Add("מספר", 50, HorizontalAlignment.Center);
            listView.Columns.Add("שם התמונה", 650, HorizontalAlignment.Center);
            //listView.Columns.Add("שם הווידאו", 600, HorizontalAlignment.Center);

            var itemCollection = new ListView.ListViewItemCollection(listView);

            var photos = from c in Lookup.Db.Table_OriginalPhotosArchives
                         select c;
            foreach (Table_OriginalPhotosArchive photo in photos)
            {
                var item = new ListViewItem();
                item.SubItems.Add(photo.PhotoId.ToString());
                item.SubItems.Add(photo.Caption);
                itemCollection.Add(item);
            }
            
            form1.Controls.Add(listView);
            listView.Refresh();

            form1.Show();

        }
开发者ID:haimon74,项目名称:KanNaim,代码行数:48,代码来源:UserControlUploadPhoto.cs

示例11: DecreaseIndexTextAndRemove

			return Tmp;

		}

		public static void DecreaseIndexTextAndRemove( PacketParser PParser , ref ListView LVw , int IndexStart )
		{
			int i = 0;
			string Tmp = "";
			int IndexInPacketCollection = -1;

			IndexInPacketCollection = int.Parse( LVw.Items[ IndexStart ].Text );

			for( i = IndexStart + 1; i < LVw.Items.Count; i ++ )
			{
				Tmp = LVw.Items[i].Text;
				int b = int.Parse( Tmp );
				b --;
				LVw.Items[i].Text = b.ToString();
			}

			PParser.PacketCollection.RemoveAt( IndexInPacketCollection );
开发者ID:dbose,项目名称:raagahacker,代码行数:21,代码来源:MyFunctions.cs


注:本文中的System.Windows.Forms.ListView.Refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。