frmOne.cs
上传用户:fan366
上传日期:2022-07-21
资源大小:406k
文件大小:23k
源码类别:

浏览器

开发平台:

Visual C++

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace OnePhoto
  9. {
  10.     public partial class frmOne : Form
  11.     {
  12.         #region  定义私有变量
  13.         
  14.         /// <summary>
  15.         /// 当前图片名称
  16.         /// </summary>
  17.         private string m_PicName;
  18.         /// <summary>
  19.         /// 当前图片路径
  20.         /// </summary>
  21.         private string m_thePath;
  22.         /// <summary>
  23.         /// 当前图片完全路径
  24.         /// </summary>
  25.         private string m_theFilePath;
  26.         /// <summary>
  27.         /// 当前图片位置
  28.         /// </summary>
  29.         private Point m_PicPoint;
  30.         /// <summary>
  31.         ///  当前光标位置
  32.         /// </summary>
  33.         private Point m_CurPoint;
  34.         /// <summary>
  35.         /// 滚轮事件
  36.         /// </summary>
  37.         private MouseWheeMsg m_MouseWheel;
  38.         #endregion 
  39.         /// <summary>
  40.         /// 构造方法
  41.         /// </summary>
  42.         public frmOne()
  43.         {
  44.             InitializeComponent();
  45.         }
  46.         #region  主菜单
  47.         private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
  48.         {
  49.             OpenOnePhoto();
  50.         }
  51.         private void 上一张ToolStripMenuItem_Click(object sender, EventArgs e)
  52.         {
  53.             PerPic();
  54.         }
  55.         private void 下一张ToolStripMenuItem_Click(object sender, EventArgs e)
  56.         {
  57.             NextPic();
  58.         }
  59.         private void 收藏ToolStripMenuItem_Click(object sender, EventArgs e)
  60.         {
  61.             SaveAsOneFile();
  62.         }
  63.         private void 关闭ToolStripMenuItem_Click(object sender, EventArgs e)
  64.         {
  65.             CloseOnePhoto();
  66.         }
  67.         private void 复制ToolStripMenuItem_Click(object sender, EventArgs e)
  68.         {
  69.         }
  70.         private void 剪切ToolStripMenuItem_Click(object sender, EventArgs e)
  71.         {
  72.         }
  73.         private void 粘贴ToolStripMenuItem_Click(object sender, EventArgs e)
  74.         {
  75.         }
  76.         private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
  77.         {
  78.         }
  79.         private void 查找ToolStripMenuItem_Click(object sender, EventArgs e)
  80.         {
  81.         }
  82.         private void 放大ToolStripMenuItem_Click(object sender, EventArgs e)
  83.         {
  84.             mimZoomLarg();
  85.         }
  86.         private void 缩小ToolStripMenuItem_Click(object sender, EventArgs e)
  87.         {
  88.             mimZoomSmall();
  89.         }
  90.         private void 适合大小ToolStripMenuItem_Click(object sender, EventArgs e)
  91.         {
  92.             mimDisplay();
  93.         }
  94.         private void 原图ToolStripMenuItem_Click(object sender, EventArgs e)
  95.         {
  96.             mimZoomReal();
  97.         }
  98.         private void 属性ToolStripMenuItem1_Click(object sender, EventArgs e)
  99.         {
  100.         }
  101.         private void 帮助主题ToolStripMenuItem_Click(object sender, EventArgs e)
  102.         {
  103.         }
  104.         private void 技术支持ToolStripMenuItem_Click(object sender, EventArgs e)
  105.         {
  106.         }
  107.         private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
  108.         {
  109.         }
  110.         #endregion 
  111.         #region  工具栏菜单
  112.         /// <summary>
  113.         /// 打开
  114.         /// </summary>
  115.         /// <param name="sender"></param>
  116.         /// <param name="e"></param>
  117.         private void toolStripButton1_Click(object sender, EventArgs e)
  118.         {
  119.             OpenOnePhoto();
  120.         }
  121.         /// <summary>
  122.         /// 上一张
  123.         /// </summary>
  124.         /// <param name="sender"></param>
  125.         /// <param name="e"></param>
  126.         private void toolStripButton2_Click(object sender, EventArgs e)
  127.         {
  128.             PerPic();
  129.         }
  130.         /// <summary>
  131.         /// 下一张
  132.         /// </summary>
  133.         /// <param name="sender"></param>
  134.         /// <param name="e"></param>
  135.         private void toolStripButton3_Click(object sender, EventArgs e)
  136.         {
  137.             NextPic();
  138.         }
  139.         /// <summary>
  140.         /// 放大
  141.         /// </summary>
  142.         /// <param name="sender"></param>
  143.         /// <param name="e"></param>
  144.         private void toolStripButton4_Click(object sender, EventArgs e)
  145.         {
  146.             mimZoomLarg();
  147.         }
  148.         /// <summary>
  149.         /// 缩小
  150.         /// </summary>
  151.         /// <param name="sender"></param>
  152.         /// <param name="e"></param>
  153.         private void toolStripButton5_Click(object sender, EventArgs e)
  154.         {
  155.             mimZoomSmall();
  156.         }
  157.         /// <summary>
  158.         ///适合大小
  159.         /// </summary>
  160.         /// <param name="sender"></param>
  161.         /// <param name="e"></param>
  162.         private void toolStripButton6_Click(object sender, EventArgs e)
  163.         {
  164.             mimDisplay();
  165.         }
  166.         /// <summary>
  167.         /// 原图
  168.         /// </summary>
  169.         /// <param name="sender"></param>
  170.         /// <param name="e"></param>
  171.         private void toolStripButton7_Click(object sender, EventArgs e)
  172.         {
  173.             mimZoomReal();
  174.         }
  175.         /// <summary>
  176.         /// 收藏
  177.         /// </summary>
  178.         /// <param name="sender"></param>
  179.         /// <param name="e"></param>
  180.         private void toolStripButton8_Click(object sender, EventArgs e)
  181.         {
  182.             SaveAsOneFile();
  183.         }
  184.         /// <summary>
  185.         /// 帮助
  186.         /// </summary>
  187.         /// <param name="sender"></param>
  188.         /// <param name="e"></param>
  189.         private void toolStripButton9_Click(object sender, EventArgs e)
  190.         {
  191.         }
  192.         #endregion
  193.         #region  右键菜单
  194.         private void 收藏ToolStripMenuItem1_Click(object sender, EventArgs e)
  195.         {
  196.             SaveAsOneFile();
  197.         }
  198.         private void 放大ToolStripMenuItem1_Click(object sender, EventArgs e)
  199.         {
  200.             mimZoomLarg();
  201.         }
  202.         private void 缩小ToolStripMenuItem1_Click(object sender, EventArgs e)
  203.         {
  204.             mimZoomSmall();
  205.         }
  206.         private void 适合大小ToolStripMenuItem1_Click(object sender, EventArgs e)
  207.         {
  208.             mimDisplay();
  209.         }
  210.         private void 原图ToolStripMenuItem1_Click(object sender, EventArgs e)
  211.         {
  212.             mimZoomReal();
  213.         }
  214.         private void 属性ToolStripMenuItem_Click(object sender, EventArgs e)
  215.         {
  216.         }
  217.         #endregion
  218.         /// <summary>
  219.         /// 关闭窗体
  220.         /// </summary>
  221.         private void CloseOnePhoto()
  222.         {
  223.             this.Close();
  224.             this.Dispose();
  225.             Application.RemoveMessageFilter(this.m_MouseWheel);
  226.             Application.Exit();
  227.         }
  228.         /// <summary>
  229.         /// 打开图片
  230.         /// </summary>
  231.         private void OpenOnePhoto()
  232.         {
  233.             try
  234.             {
  235.                 this.toolStripStatusLabel2.Text = "打开图片文件";
  236.                 OpenFileDialog Ofd = new OpenFileDialog();
  237.                 Ofd.Filter = "jpg(*.jpg)|*.jpg|jpeg(*.jpeg)|*.jpeg|bmp(*.bmp)|*.bmp|gif(*.gif)|*.gif|tif(*.tif)|*.tif|png(*.png)|*.png";
  238.                 Ofd.DefaultExt = "*.jpg";
  239.                 //只读
  240.                 Ofd.ShowReadOnly = true;
  241.                 Ofd.Title = "选择图片文件";
  242.                 if (Ofd.ShowDialog() == DialogResult.OK)
  243.                 {
  244.                     int num = Ofd.FilterIndex;
  245.                     string FileType = Ofd.DefaultExt;
  246.                     switch(num)
  247.                     {
  248.                         case 1:
  249.                             FileType = "*.jpg";
  250.                             break;
  251.                         case 2:
  252.                             FileType = "*.jpeg";
  253.                             break;
  254.                         case 3:
  255.                             FileType = "*.bmp";
  256.                             break;
  257.                         case 4:
  258.                             FileType = "*.gif";
  259.                             break;
  260.                         case 5:
  261.                              FileType = "*.tif";
  262.                             break;
  263.                         case 6:
  264.                              FileType = "*.png";
  265.                             break;
  266.                          default:
  267.                              FileType = "*.jpg";
  268.                             break;
  269.                     }
  270.                     m_theFilePath = Ofd.FileName;
  271.                     ListOnePhoto(m_theFilePath, FileType);
  272.                     string theName = Ofd.FileName;
  273.                     int FileStart = theName.LastIndexOf("\");
  274.                     int FileLen = (theName.Length - FileStart);
  275.                     m_PicName = theName.Substring(FileStart + 1, FileLen - 1);
  276.                     this.Text = "图片查看器  " + m_PicName;
  277.                     this.toolStripStatusLabel1.Text = "名称:" + m_PicName;
  278.                     this.toolStripStatusLabel2.Text = "打开图片" + m_PicName;
  279.                     this.toolStripStatusLabel3.Text = System.DateTime.Today.ToLongDateString();
  280.                     this.pictureBoxPic.Image = Image.FromFile(m_theFilePath);
  281.                     this.pictureBoxPic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
  282.                     this.mimZoomReal();
  283.                 }
  284.                 else
  285.                 {
  286.                     this.toolStripStatusLabel2.Text = "取消选择图片文件";
  287.                 }
  288.                 Ofd.Dispose();
  289.             }
  290.             catch (Exception e1)
  291.             {
  292.                 this.toolStripStatusLabel2.Text = "打开图片失败,原因:" + e1.Message.ToString() + "!";
  293.             }
  294.         }
  295.         #region 图片放大缩小
  296.         /// <summary>
  297.         /// 放大
  298.         /// </summary>
  299.         private void mimZoomLarg()
  300.         {
  301.             if ((this.pictureBoxPic.Image != null) && (this.pictureBoxPic.Width < 2000))
  302.             {
  303.                 this.toolStripStatusLabel2.Text = "放大图片+5%" ;
  304.                 this.pictureBoxPic.Width = System.Convert.ToInt32(this.pictureBoxPic.Width * (1 + 0.1));
  305.                 this.pictureBoxPic.Height = System.Convert.ToInt32(this.pictureBoxPic.Height * (1 + 0.1));
  306.                 int Picx = System.Convert.ToInt32((this.panelImg.Width - this.pictureBoxPic.Width) * 0.5);
  307.                 int Picy = System.Convert.ToInt32((this.panelImg.Height - this.pictureBoxPic.Height) * 0.5);
  308.                 this.pictureBoxPic.Location = new System.Drawing.Point(Picx, Picy);
  309.             }
  310.         }// end void
  311.         /// <summary>
  312.         /// 缩小
  313.         /// </summary>
  314.         private void mimZoomSmall()
  315.         {
  316.             if (this.pictureBoxPic.Image != null && (this.pictureBoxPic.Width > 100))
  317.             {
  318.                 this.toolStripStatusLabel2.Text = "缩小图片-5%";
  319.                 this.pictureBoxPic.Width = System.Convert.ToInt32(this.pictureBoxPic.Width / (1 + 0.1));
  320.                 this.pictureBoxPic.Height = System.Convert.ToInt32(this.pictureBoxPic.Height / (1 + 0.1));
  321.                 int Picx = System.Convert.ToInt32((this.panelImg.Width - this.pictureBoxPic.Width) * 0.5);
  322.                 int Picy = System.Convert.ToInt32((this.panelImg.Height - this.pictureBoxPic.Height) * 0.5);
  323.                 this.pictureBoxPic.Location = new System.Drawing.Point(Picx, Picy);
  324.             }
  325.         }// end void
  326.         /// <summary>
  327.         /// 原图
  328.         /// </summary>
  329.         private void mimZoomReal()
  330.         {
  331.             if (this.pictureBoxPic.Image != null)
  332.             {
  333.                 this.toolStripStatusLabel2.Text = "图片原始大小显示";
  334.                 this.pictureBoxPic.Width = this.pictureBoxPic.Image.Width;
  335.                 this.pictureBoxPic.Height = this.pictureBoxPic.Image.Height;
  336.                 int Picx = System.Convert.ToInt32((this.panelImg.Width - this.pictureBoxPic.Width) * 0.5);
  337.                 int Picy = System.Convert.ToInt32((this.panelImg.Height - this.pictureBoxPic.Height) * 0.5);
  338.                 this.pictureBoxPic.Location = new System.Drawing.Point(Picx, Picy);
  339.             }
  340.         }// end void
  341.         /// <summary>
  342.         /// 适合大小
  343.         /// </summary>
  344.         private void mimDisplay()
  345.         {
  346.             if (this.pictureBoxPic.Image != null)
  347.             {
  348.                 this.toolStripStatusLabel2.Text = "图片适合大小显示";
  349.                 int dWidth = this.pictureBoxPic.Image.Width;
  350.                 int dHeight = this.pictureBoxPic.Image.Height;
  351.                 decimal i = dWidth / dHeight;
  352.                 if (i == 0)
  353.                 {
  354.                     i = 1;
  355.                 }
  356.                 this.pictureBoxPic.Width = this.panelImg.Width - 16;
  357.                 this.pictureBoxPic.Height = System.Convert.ToInt32(this.panelImg.Width / i);
  358.                 if (this.pictureBoxPic.Height > this.panelImg.Height)
  359.                 {
  360.                     this.pictureBoxPic.Height = this.panelImg.Height - 32;
  361.                     this.pictureBoxPic.Width = System.Convert.ToInt32(this.panelImg.Height * i);
  362.                 }
  363.                 int Picx = System.Convert.ToInt32((this.panelImg.Width - this.pictureBoxPic.Width) * 0.5);
  364.                 int Picy = System.Convert.ToInt32((this.panelImg.Height - this.pictureBoxPic.Height) * 0.5);
  365.                 this.pictureBoxPic.Location = new System.Drawing.Point(Picx, Picy);
  366.             }
  367.         }// end void
  368.         #endregion 
  369.         /// <summary>
  370.         /// 加载窗体
  371.         /// </summary>
  372.         /// <param name="sender"></param>
  373.         /// <param name="e"></param>
  374.         private void frmOne_Load(object sender, EventArgs e)
  375.         {
  376.             /////定义鼠标滚轮事件
  377.             this.m_MouseWheel = new MouseWheeMsg();
  378.             Application.AddMessageFilter(this.m_MouseWheel);
  379.             this.m_MouseWheel.MouseWheel += new MouseWheelHandler(MouseWheeMsg_MouseWheel);
  380.             OpenOnePhoto();
  381.         }// end void
  382.         #region 图片移动
  383.         private void pictureBoxPic_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
  384.         {
  385.             if (e.Button == MouseButtons.Left)
  386.             {
  387.                 this.m_PicPoint = new Point(e.X - this.m_CurPoint.X, e.Y - this.m_CurPoint.Y);
  388.                 this.m_PicPoint.Offset(this.pictureBoxPic.Location.X, this.pictureBoxPic.Location.Y);
  389.                 this.pictureBoxPic.Location = this.m_PicPoint;
  390.             }// end if
  391.         }
  392.         private void pictureBoxPic_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
  393.         {
  394.             this.m_CurPoint = this.pictureBoxPic.PointToClient(System.Windows.Forms.Cursor.Position);
  395.         }
  396.         /// <summary>
  397.         /// 滚轮滚动
  398.         /// </summary>
  399.         /// <param name="sender"></param>
  400.         /// <param name="isDelta"></param>
  401.         private void MouseWheeMsg_MouseWheel(object sender, bool isDelta)
  402.         {
  403.             if (isDelta)
  404.             {
  405.                 mimZoomSmall();
  406.             }
  407.             else
  408.             {
  409.                 mimZoomLarg();
  410.             }
  411.         }//end void
  412.         private void pictureBoxPic_MouseLeave(object sender, EventArgs e)
  413.         {
  414.             this.Cursor = System.Windows.Forms.Cursors.Default;
  415.             /////////////移出鼠标滚轮事件
  416.             //Application.RemoveMessageFilter( this.m_MouseWheeMsg );
  417.             this.m_MouseWheel.SetHandleType = false;
  418.         }//end void
  419.         private void pictureBoxPic_MouseEnter(object sender, EventArgs e)
  420.         {
  421.             this.Cursor = System.Windows.Forms.Cursors.Hand;
  422.             /////////////增加鼠标滚轮事件
  423.             this.m_MouseWheel.SetHandleType = true;
  424.             //Application.AddMessageFilter( this.m_MouseWheeMsg );
  425.         }//end void
  426.         #endregion
  427.         /// <summary>
  428.         /// 显示图片列表
  429.         /// </summary>
  430.         private void ListOnePhoto(string PicFilePath, string FileType )
  431.         {
  432.            
  433.             int Fileend = PicFilePath.LastIndexOf("\");
  434.             m_thePath = PicFilePath.Substring(0, Fileend);
  435.             try
  436.             {
  437.                 this.listView1.Columns.Clear();
  438.                 this.listView1.Items.Clear();
  439.                 this.listView1.Columns.Add("图片",170);
  440.                 if (System.IO.Directory.Exists(m_thePath))
  441.                 {
  442.                     string[] s = System.IO.Directory.GetFileSystemEntries(m_thePath, FileType);
  443.                     int j = s.Length;
  444.                     if (j > 0)
  445.                     {
  446.                         string filesname = null;
  447.                         for (int i = 0; i < j; i++)
  448.                         {
  449.                             string[] thifiles = System.IO.Directory.GetFiles(m_thePath, FileType);
  450.                             filesname = thifiles.GetValue(i).ToString().Trim();
  451.                             int FileStart = filesname.LastIndexOf("\");
  452.                             int FileLen = (filesname.Length - FileStart);
  453.                             filesname = filesname.Substring(FileStart + 1, FileLen - 1);
  454.                            this.listView1.Items.Add(filesname,0);
  455.                         }//end for
  456.                     }
  457.                     else
  458.                     {
  459.                         this.toolStripStatusLabel2.Text = "当前路径下没有文件!";
  460.                     }
  461.                 }// end if
  462.                 else
  463.                 {
  464.                     this.toolStripStatusLabel2.Text = "当前路径无效!请重新选择文件路径!";
  465.                 }
  466.             }
  467.             catch (Exception e1)
  468.             {
  469.                  this.toolStripStatusLabel2.Text = "选择图片文件异常!";
  470.                 string right = e1.Message.ToString();
  471.             }// end catch
  472.         }
  473.         /// <summary>
  474.         /// 获取路径
  475.         /// </summary>
  476.         /// <returns></returns>
  477.         private string GetSavePath()
  478.         {
  479.             string Path = "";
  480.             System.Windows.Forms.FolderBrowserDialog  fbdPic  = new FolderBrowserDialog();
  481.             if (fbdPic.ShowDialog() == DialogResult.OK)
  482.             {
  483.                 Path = fbdPic.SelectedPath;
  484.             }
  485.             return Path;
  486.         }
  487.         /// <summary>
  488.         /// 图片收藏另存
  489.         /// </summary>
  490.         private void SaveAsOneFile()
  491.         {
  492.             try
  493.             {
  494.                 System.Drawing.Image theImg = this.pictureBoxPic.Image;
  495.                 if (theImg != null )
  496.                 {
  497.                     string FileName = this.toolStripStatusLabel1.Text.Replace("名称:", "");
  498.                     if (FileName.IndexOf(".", 0) <= 0)
  499.                     {
  500.                         FileName = FileName + ".jpeg";
  501.                     }
  502.                     string Path = GetSavePath();
  503.                     if (Path != "" && Path != null)
  504.                     {
  505.                         if (!System.IO.Directory.Exists(Path))
  506.                         {
  507.                             System.IO.Directory.CreateDirectory(Path);
  508.                         }
  509.                         string FullPath = Path + @"" + FileName;
  510.                         this.toolStripStatusLabel2.Text = "正在保存图片 " + FileName;
  511.                         this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
  512.                         byte[] bytFiles;
  513.                         using (System.IO.MemoryStream thems = new System.IO.MemoryStream())
  514.                         {
  515.                             theImg.Save(thems, System.Drawing.Imaging.ImageFormat.Jpeg);
  516.                             bytFiles = thems.ToArray();
  517.                             thems.Close();
  518.                         }
  519.                         using (System.IO.FileStream fs = new System.IO.FileStream(FullPath, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite))
  520.                         {
  521.                             fs.Write(bytFiles, 0, bytFiles.Length);
  522.                             fs.Close();
  523.                         }// end using
  524.                         this.toolStripStatusLabel2.Text = "图片 " + FileName + " 保存成功!" + "收藏夹路径 " + Path + " !";
  525.                         this.Cursor = System.Windows.Forms.Cursors.Default;
  526.                     }
  527.                     else
  528.                     {
  529.                         toolStripStatusLabel2.Text = "没有选择一个收藏夹,不能保存图片!";
  530.                     }
  531.                 }
  532.                 else
  533.                 {
  534.                     toolStripStatusLabel2.Text = "没有选择图片,请打开一个图片!";
  535.                 }
  536.             }//try
  537.             catch (Exception e)
  538.             {
  539.                 string Sreason = e.Message.ToString();
  540.                 toolStripStatusLabel2.Text = "图片保存失败!";
  541.             }// end catch
  542.         }// end void
  543.         private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  544.         {
  545.             //检查是否有选择的项,如果没有选择的项则禁用 打开
  546.             int SelCount = this.listView1.SelectedItems.Count;
  547.             if (SelCount == 1)
  548.             {
  549.                 this.m_PicName = this.listView1.SelectedItems[0].SubItems[0].Text;
  550.                 this.Text = "图片查看器  " + m_PicName;
  551.                 m_theFilePath = this.m_thePath + @"" + m_PicName;
  552.                 this.toolStripStatusLabel3.Text = System.DateTime.Today.ToLongDateString();
  553.                 this.pictureBoxPic.Image = Image.FromFile(m_theFilePath);
  554.                 this.pictureBoxPic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
  555.                 this.mimZoomReal();
  556.                 this.toolStripStatusLabel1.Text = "名称:" + m_PicName;
  557.                 this.toolStripStatusLabel2.Text = "打开图片" + m_PicName;
  558.             }
  559.         }
  560.         /// <summary>
  561.         ///  下一张图片
  562.         /// </summary>
  563.         /// <returns></returns>
  564.         private void NextPic()
  565.         {
  566.            
  567.             int  PicNum  = this.listView1.Items.Count;
  568.             for (int i = 0; i < (PicNum - 1); i++)
  569.             {
  570.                 string name = this.listView1.Items[i].SubItems[0].Text;
  571.                 if (name == this.m_PicName)
  572.                 {
  573.                     this.m_PicName = this.listView1.Items[i + 1].SubItems[0].Text;
  574.                     this.listView1.Items[i + 1].Selected = true;
  575.                     break;
  576.                 }
  577.             }
  578.            
  579.         }//end void 
  580.         /// <summary>
  581.         ///上一张图片
  582.         /// </summary>
  583.         /// <returns></returns>
  584.         private void PerPic()
  585.         {
  586.             int PicNum = this.listView1.Items.Count;
  587.             for (int i = 0; i < (PicNum); i++)
  588.             {
  589.                 string name = this.listView1.Items[i].SubItems[0].Text;
  590.                 if( (name == this.m_PicName) && ( i > 0 ))
  591.                 {  
  592.                     this.m_PicName = this.listView1.Items[i - 1].SubItems[0].Text;
  593.                     this.listView1.Items[ i - 1].Selected = true;
  594.                     break;
  595.                 }
  596.             }
  597.         }//end void 
  598.     }
  599. }