S
Steph
I am trying to bind a simple ImageList Control to a PictureBox. I
can't seem to find in documentation, or through trial and error, the
right ImageList data member to bind to. Nothing seems to work. The
code below attempts to bind the PictureBox "pbMain" to the ImageList
"ilPics" which is successfully loaded with images from a test
directory. The question mark in the "DataBindings.Add" method
indicates the parameter in question. Has anyone else successfully
done this and could you help me out?
private void PicView_Load(object sender, System.EventArgs e)
{
// Get all files in sample directory
DirectoryInfo dirImages = new DirectoryInfo("C:\\data\\All
Images\\image.assets");
foreach (FileInfo file in dirImages.GetFiles())
{
if (file.Extension == ".jpg")
{
Image myImage = Image.FromFile(file.FullName);
ilPics.Images.Add(myImage);
}
}
// bind to picture box
pbMain.DataBindings.Add("Image",ilPics, ?);
}
can't seem to find in documentation, or through trial and error, the
right ImageList data member to bind to. Nothing seems to work. The
code below attempts to bind the PictureBox "pbMain" to the ImageList
"ilPics" which is successfully loaded with images from a test
directory. The question mark in the "DataBindings.Add" method
indicates the parameter in question. Has anyone else successfully
done this and could you help me out?
private void PicView_Load(object sender, System.EventArgs e)
{
// Get all files in sample directory
DirectoryInfo dirImages = new DirectoryInfo("C:\\data\\All
Images\\image.assets");
foreach (FileInfo file in dirImages.GetFiles())
{
if (file.Extension == ".jpg")
{
Image myImage = Image.FromFile(file.FullName);
ilPics.Images.Add(myImage);
}
}
// bind to picture box
pbMain.DataBindings.Add("Image",ilPics, ?);
}