// Methods
            public ListBoxItem(DataGridViewColumn column, ExtDataGridColumnCollectionDialog owner, ComponentDesigner compDesigner)
            {
                this.column       = column;
                this.owner        = owner;
                this.compDesigner = compDesigner;
                if (this.compDesigner != null)
                {
                    this.compDesigner.Initialize(column);
                    TypeDescriptor.CreateAssociation(this.column, this.compDesigner);
                }
                ToolboxBitmapAttribute attribute = TypeDescriptor.GetAttributes(column)[ExtDataGridColumnCollectionDialog.toolboxBitmapAttributeType] as ToolboxBitmapAttribute;

                if (attribute != null)
                {
                    this.toolboxBitmap = attribute.GetImage(column, false);
                }
                else
                {
                    //this.toolboxBitmap = this.owner.SelectedColumnsItemBitmap;
                }
                DataGridViewColumnDesigner designer = compDesigner as DataGridViewColumnDesigner;

                if (designer != null)
                {
                    //designer.LiveDataGridView = this.owner.liveDataGridView;
                }
            }
Exemplo n.º 2
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (provider != null)
     {
         IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if ((service == null) || (context.Instance == null))
         {
             return(value);
         }
         IDesignerHost host = (IDesignerHost)provider.GetService(typeof(IDesignerHost));
         if (host == null)
         {
             return(value);
         }
         if (this.extDataGridColumnCollectionDialog == null)
         {
             this.extDataGridColumnCollectionDialog = new ExtDataGridColumnCollectionDialog();
         }
         //this.extDataGridColumnCollectionDialog.SetDataGrid((ExtDataGrid)context.Instance);
         using (DesignerTransaction transaction = host.CreateTransaction("ExtDataGridColumnCollectionTransaction"))
         {
             if (service.ShowDialog(this.extDataGridColumnCollectionDialog) == DialogResult.OK)
             {
                 transaction.Commit();
                 return(value);
             }
             transaction.Cancel();
         }
     }
     return(value);
 }