C# 你在这条线上做了什么列表视图1.Items[\u imageIndex].Selected=true因此,您正在访问列表视图中的项目,并为图像使用一个新计数器,然后使用Selected属性选择它以触发事件listView1\u SelectedIndexC
C# 你在这条线上做了什么列表视图1.Items[\u imageIndex].Selected=true因此,您正在访问列表视图中的项目,并为图像使用一个新计数器,然后使用Selected属性选择它以触发事件listView1\u SelectedIndexC,c#,image,listview,picturebox,imagelist,C#,Image,Listview,Picturebox,Imagelist,你在这条线上做了什么列表视图1.Items[\u imageIndex].Selected=true因此,您正在访问列表视图中的项目,并为图像使用一个新计数器,然后使用Selected属性选择它以触发事件listView1\u SelectedIndexChanged。从那里,您将遍历所有项目,以到达当前所选项目之后的项目。好啊希望我读对了,或者至少接近了。最后一件事,如果我给了一个到实际应用程序的dropbox链接,会更容易吗?@JordanNash读得完全正确。至于DropBox链接-否。我
你在这条线上做了什么<代码>列表视图1.Items[\u imageIndex].Selected=true因此,您正在访问列表视图中的项目,并为图像使用一个新计数器,然后使用
Selected
属性选择它以触发事件listView1\u SelectedIndexChanged
。从那里,您将遍历所有项目,以到达当前所选项目之后的项目。好啊希望我读对了,或者至少接近了。最后一件事,如果我给了一个到实际应用程序的dropbox链接,会更容易吗?@JordanNash读得完全正确。至于DropBox链接-否。我的工作代理阻止了对文件共享服务的访问,这会导致非常糟糕的问题/答案,因为外部链接可能会随着时间的推移而消失
string _big_fileName;
int _counter = 0;
public Form1()
{
InitializeComponent();
}
//Displays larger instance of selected image in picture box.
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
//FOR i is less than the first image.
for (int i = 0; i < listView1.SelectedItems.Count;i++)
{
//GET filename from listview and store in index.
_big_fileName = listView1.SelectedItems[i].Text;
//Create larger instance of image.
pictureBox1.Image = Image.FromFile(_big_fileName);
//Fill panel to the width and height of picture box.
panel1.AutoScrollMinSize = new Size(pictureBox1.Image.Width,
pictureBox1.Image.Height);
}
}
private void mnuOpen_Click(object sender, EventArgs e)
{
loadImageList();
}
private void btnNext_Click(object sender, EventArgs e)
{
if(pictureBox1.Image != null)
{
//IF Image is less than Image list size.
if (pictureBox1.Image < imageList1.Images.Count)
{
//ACCESS Imagelist size against image value
_big_fileName = listView1.SelectedItems[_counter].Text;
//INCREMENT Image list current position.
_counter++;
//ASSIGN current position to image.
pictureBox1.Image = Image.FromFile(_big_fileName);
//DISPLAY and enlarge image.
panel1.AutoScrollMinSize = new Size(pictureBox1.Image.Width,
pictureBox1.Image.Height);
}
}
else
{
MessageBox.Show("No image.");
}
}
private void loadImageList()
{
imageList1.Images.Clear();
listView1.Clear();
oFD1.InitialDirectory = "C:\\";
oFD1.Title = "Open an Image File";
oFD1.Filter = "JPEGS|*.jpg|GIFS|*.gif|PNGS|*.png|BMPS|*.bmp";
//Open Dialog Box.
var oldResults = oFD1.ShowDialog();
if (oldResults == DialogResult.Cancel)
{
return;
}
try
{
//GET amount of filenames.
int num_of_files = oFD1.FileNames.Length;
//Store filenames in string array.
string[] arryFilePaths = new string[num_of_files];
//FOREACH filename in the file.
foreach (string single_file in oFD1.FileNames)
{
//ACCESS array using _counter to find file.
arryFilePaths[_counter] = single_file;
//CREATE image in memory and add image to image list.
imageList1.Images.Add(Image.FromFile(single_file));
_counter++;
}
//BIND image list to listview.
listView1.LargeImageList = imageList1;
for (int i = 0; i < _counter; i++)
{
//DISPLAY filename and image from image index param.
listView1.Items.Add(arryFilePaths[i], i);
}
}
catch (Exception ex)
{
MessageBox.Show("Error " + ex.Message);
}
}
int _imageIndex;
_imageIndex = 0;
if (pictureBox1.Image < imageList1.Images.Count)
if (_imageIndex < imageList1.Images.Count)
_big_fileName = listView1.SelectedItems[_counter].Text;
_big_fileName = listView1.SelectedItems[_imageIndex].Text;
_imageIndex++;
private void btnNext_Click(object sender, EventArgs e)
{
//IF Image is less than Image list size.
if (_imageIndex < imageList1.Images.Count)
{
listView1.Items[_imageIndex].Selected = true;
_imageIndex++;
}
}