开发者

how can i get image from listview and assign to picturebox?

开发者 https://www.devze.com 2023-01-06 21:53 出处:网络
i have one listview in which i have stored images, now for my slide show i want this images to picture box. b开发者_StackOverflow中文版ut not getting exact way to get images from the listview.

i have one listview in which i have stored images, now for my slide show i want this images to picture box. b开发者_StackOverflow中文版ut not getting exact way to get images from the listview.

can anybody has some idea about this ?

thanks in advance.


I had a similar problem some while ago. This artical from Microsoft was very helpfull: http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image%28VS.80%29.aspx

Especially this part

   ListViewItem selection = ListView1.GetItemAt(e.X, e.Y);

   // If the user selects an item in the ListView, display
   // the image in the PictureBox.
   if (selection != null)
   {
        PictureBox1.Image = System.Drawing.Image.FromFile(
            selection.SubItems[1].Text);
   }
0

精彩评论

暂无评论...
验证码 换一张
取 消