Exemple #1
0
        private void LoadFilters()
        {
            var imgFiles = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + "\\img\\", "*.png");

            foreach (var imgFile in imgFiles)
            {
                imageList1.Images.Add(new Bitmap(imgFile));
            }

            var filterEnums = Enum.GetValues(typeof(FilterEnum)).Cast <FilterEnum>().ToList();

            FiltersList.Items.Clear();
            ImageAndText[] imageAndTexts = new ImageAndText[filterEnums.Count + 1];
            imageAndTexts[0] = new ImageAndText(imageList1.Images[0], "Original", DefaultFont);

            for (var i = 0; i < filterEnums.Count; i++)
            {
                var filterEnum = filterEnums[i];
                imageAndTexts[i + 1] = new ImageAndText(imageList1.Images[i + 1], filterEnum.ToString(), DefaultFont);
            }

            FiltersList.DisplayImagesAndText(imageAndTexts);
            //FiltersList.SelectedIndex = 0;
            if (FiltersList.Items.Count > 0)
            {
                FiltersList.SelectedIndex = 0;
            }
        }