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


C# ListView.Select方法代码示例

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


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

示例1: LoadNodeDir

        private void LoadNodeDir(TreeNode node)
        {
            if (!Directory.Exists(((tree_tag)node.Tag).strPath))
            {
                return;
            }

            Control ctrl_parent = lv1.Parent;
            ctrl_parent.Controls.Remove(lv1);

            if (((tree_tag)node.Tag).listv != null)
            {
                lv1 = ((tree_tag)node.Tag).listv;
                ctrl_parent.Controls.Add(lv1);
                lv1.Enabled = true;
                lv1.Visible = true;
                lv1.Select();
                autoSelect(lv1);
                return;
            }

            fl.Show();
            fl.Enabled = false;

            tv1.Enabled = false;

            lv1 = new ListView();

            lv1.SelectedIndexChanged    += new System.EventHandler(lv1_SelectedIndexChanged);
            lv1.DoubleClick             += new EventHandler(lv1_DoubleClick);
            lv1.LargeImageList          = imageList1;
            lv1.Dock                    = DockStyle.Fill;
            lv1.MultiSelect             = false;

            ctrl_parent.Controls.Add(lv1);
            //lv1.Clear();

            DirectoryInfo di = new DirectoryInfo(((tree_tag)node.Tag).strPath);
            fl.pbar.Maximum = di.GetFiles().Length;
            fl.pbar.Value = 0;
            ListView.ListViewItemCollection lvc = new ListView.ListViewItemCollection(lv1);
            lv1.Visible = false;
            lv2.Visible = true;

            if(this.showFolder == true)
            {
                string stroutout = string.Empty;
                foreach (DirectoryInfo d in di.GetDirectories())
                {
                    if (d.Name == ".svn" || d.Name == "Texture") continue;

                    Application.DoEvents();
                    fl.label1.Text = d.FullName;
                    if (imageList1.Images.ContainsKey(d.FullName))
                    {
                        lvc.Add(d.Name, d.FullName).Tag = "folder";
                        continue;
                    }
                    Image imgFolder = imageList3.Images["folder.bmp"];
                    FileInfo[] files = d.GetFiles(this.strFolderPreviewFilter);
                    if(files.Length == 0)
                    {
                        DirectoryInfo[] d111 = d.GetDirectories("模型");
                        if (d111.Length > 0)
                            files = d111[0].GetFiles(this.strFolderPreviewFilter);
                    }
                    //    
                    if(files.Length == 0)   //普通目录
                    {
                        imageList1.Images.Add(d.FullName, imgFolder);
                        lvc.Add(d.Name, d.FullName).Tag = "folder";
                        continue;
                    }
                    Debug.WriteLine(files[0].FullName);
                    stroutout += files[0].FullName + "\r\n";
                    sprViewer.SPRItem si = new sprViewer.SPRItem(files[0].FullName, sprViewer.SPRItem.PIC_TYPE.MDL, m_engine);

                    //check cache
                    if (File.Exists(si.tgaFileName + "!.BMP")
                        && d.LastWriteTime.ToString() == sprViewer.IniIO.IniReadValue("cache", "time", si.tgaFileName + "_tb.ini"))
                    {
                        Image img = new Bitmap(si.tgaFileName + "!.BMP");
                        imageList1.Images.Add(d.FullName, img);
                    }
                    else
                    {
                        int ind = si.TGAList.Count / 2;
                        ind = ind == 0 ? 1 : ind;
                        string strFile = si.TGAList[ind.ToString()].ToString();
                        if (File.Exists(strFile))
                        {
                            Image img = Image.FromFile(strFile);
                            Image imgsmall = img.GetThumbnailImage(80, 80, null, IntPtr.Zero);
                            //imgsmall.Save(@"C:\Documents and Settings\kuangsihao\桌面\newtools\_cache\mdl\folder.bmp");
                            Image imgCombo = new Bitmap(imgFolder);
                            Graphics g = Graphics.FromImage(imgCombo);
                            //g.DrawImage(imgsmall, new Point(0, 0));
                            g.DrawImage(imgsmall, new Rectangle(6, 8, imgsmall.Width, imgsmall.Height));
                            //g.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height));
                            imgCombo.Save(si.tgaFileName + "!.BMP");
//.........这里部分代码省略.........
开发者ID:viticm,项目名称:pap2,代码行数:101,代码来源:frmSelect.cs

示例2: ReforcusListView

        /// <summary>
        /// リストビューのフォーカスをリセットします。
        /// </summary>
        /// <param name="listView">対象のリストビュー</param>
        private void ReforcusListView(ListView listView)
        {
            // ListViewItemSorterを解除する
            listView.ListViewItemSorter = null;

            // ツリービューとリストビューの表示を更新する
            UpdateTreeView();
            UpdateListView();

            // ListViewItemSorterを指定する
            listView1.ListViewItemSorter = listViewItemSorter;

            // フォーカスを当て直す
            listView.Items[currentRow].Selected = true;
            listView.SelectedItems[0].EnsureVisible();
            listView.Select();
            listView.Focus();
        }
开发者ID:kinokino2010,项目名称:AkaneMail,代码行数:22,代码来源:MainForm.cs


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