14-09-19, 09:37 PM
(آخر تعديل لهذه المشاركة : 14-09-19, 09:47 PM {2} بواسطة Rabeea Qbaha.)
(14-09-19, 07:44 PM)issamsaidd كتب : شكرا لكم هل من كود لحذف الصورة المحدده من listView ومن المسار الخاص بها فقط لصورة واحددة واشكركم جزيل الشكر
كود :
private void Button1_Click(object sender, EventArgs e)
{
string filePath = text;
FileInfo file = new FileInfo(filePath);
if (file.Exists)
{
file.Delete();
}
foreach (ListViewItem eachItem in listView1.SelectedItems)
{
listView1.Items.Remove(eachItem);
}
}
String text;
private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listView1.SelectedIndices.Count <= 0)
{
return;
}
int intselectedindex = listView1.SelectedIndices[0];
if (intselectedindex >= 0)
{
text = listView1.Items[intselectedindex].Text;
//do something
picturebox1.image = Image.FromFile(text);
}
}
