本文整理汇总了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");
//.........这里部分代码省略.........
示例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();
}