Beispiel #1
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            wfes = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if ((wfes == null) || (context == null))
            {
                return(null);
            }
            ImageList imageList = GetImageList(context.Instance);

            if ((imageList == null) || (imageList.Images.Count == 0))
            {
                return(-1);
            }
            m_imagePanel = new ImageListPanel();
            m_imagePanel.BackgroundColor     = Color.FromArgb(241, 241, 241);
            m_imagePanel.BackgroundOverColor = Color.FromArgb(102, 154, 204);
            m_imagePanel.HLinesColor         = Color.FromArgb(182, 189, 210);
            m_imagePanel.VLinesColor         = Color.FromArgb(182, 189, 210);
            m_imagePanel.BorderColor         = Color.FromArgb(0, 0, 0);
            m_imagePanel.EnableDragDrop      = true;
            m_imagePanel.Init(imageList, 12, 12, 6, (int)value);
            m_imagePanel.ItemClick += new ImageListPanelEventHandler(OnItemClicked);
            m_selectedIndex         = -1;
            wfes.DropDownControl(m_imagePanel);
            return((m_selectedIndex != -1) ? m_selectedIndex : (int)value);
        }
Beispiel #2
0
 public void OnItemClicked(object sender, ImageListPanelEventArgs e)
 {
     m_selectedIndex         = ((ImageListPanelEventArgs)e).SelectedItem;
     m_imagePanel.ItemClick -= new ImageListPanelEventHandler(OnItemClicked);
     wfes.CloseDropDown();
     m_imagePanel.Dispose();
     m_imagePanel = null;
 }