Example #1
0
        public void LoadValue(CatShow catShow)
        {
            if (catShow == null)
            {
                return;
            }
            var gc = galleryControl1;

            gc.Gallery.ItemImageLayout = ImageLayoutMode.ZoomInside;
            gc.Gallery.ImageSize       = new Size(120, 90);
            gc.Gallery.ShowItemText    = true;
            gc.Gallery.Groups.Clear();
            foreach (var cse in catShow.CatEvents)
            {
                var group = new GalleryItemGroup
                {
                    CaptionControl = new CatShowGroupCaptionControl {
                        CaptionText = cse.EventName
                    }
                };
                group.CaptionAlignment   = GalleryItemGroupCaptionAlignment.Stretch;
                group.CaptionControlSize = new Size(20, 20);
                foreach (var sec in cse.EventSections)
                {
                    var item = new GalleryItem
                    {
                        // Caption = sec.EventSectionName, Image = Image.FromFile("c:\\images\\ford.jpg")
                        Caption = sec.EventSectionName,
                        Image   = ImageLoader.Instance.GetImageInfo("ford").Image
                    };
                    group.Items.Add(item);
                }

                gc.Gallery.Groups.Add(group);
            }

            var i = 1;

            foreach (GalleryItemGroup g in gc.Gallery.Groups)
            {
                g.Items.Add(new GalleryItem {
                    Caption = $"caption {i}"
                });
                i++;
            }
            // gc.Refresh();
            //var sz = new Size
            //{
            //    Height = galleryControl1.Gallery.GalleryControl.Height,
            //    Width = galleryControl1.Gallery.GalleryControl.Width
            //};
            //galleryControl1.MinimumSize = sz;
            gc.Refresh();
        }
Example #2
0
        private CatShow MakeCatShow()
        {
            var cs = new CatShow
            {
                CatEvents = new List <CatShowEvent>
                {
                    new CatShowEvent
                    {
                        EventName     = "One",
                        EventSections =
                        {
                            new EventSection {
                                EventSectionName = "E1"
                            },
                            new EventSection {
                                EventSectionName = "E2"
                            },
                            new EventSection {
                                EventSectionName = "E2"
                            }
                        }
                    },
                    new CatShowEvent
                    {
                        EventName     = "Two",
                        EventSections =
                        {
                            new EventSection {
                                EventSectionName = "E21"
                            },
                            new EventSection {
                                EventSectionName = "E22"
                            },
                            new EventSection {
                                EventSectionName = "E22"
                            }
                        }
                    },
                    new CatShowEvent
                    {
                        EventName     = "Three",
                        EventSections =
                        {
                            new EventSection {
                                EventSectionName = "E31"
                            },
                            new EventSection {
                                EventSectionName = "E32"
                            },
                            new EventSection {
                                EventSectionName = "E32"
                            }
                        }
                    },
                    new CatShowEvent
                    {
                        EventName     = "Four",
                        EventSections =
                        {
                            new EventSection {
                                EventSectionName = "E31"
                            },
                            new EventSection {
                                EventSectionName = "E32"
                            },
                            new EventSection {
                                EventSectionName = "E32"
                            }
                        }
                    }
                }
            };

            return(cs);
        }