Custom Form Designer for users of application at runtime

Verrouillé Custom Form Designer for users of application at runtime

  • dimanche 22 juillet 2012 06:44
     
     

    How can we design a custom Form Designer for our application users?

    So that they can change control position and some other properties at run time.

    Thanks and regards,

    Kunal

Toutes les réponses

  • lundi 23 juillet 2012 03:39
     
     Traitée A du code

    Hi all,

    I have looked into the problem and after lot of search found the following solution.

    The following code belongs to the Assembly name: DesignSurfaceExt

    //->DesignerOptionServiceExt.cs

    internal class DesignerOptionServiceExt4SnapLines : DesignerOptionService {
    public DesignerOptionServiceExt4SnapLines() : base() { }
    
        protected override void PopulateOptionCollection ( DesignerOptionCollection options ) {
            if ( null != options.Parent ) return;
    
            DesignerOptions ops = new DesignerOptions();
            ops.UseSnapLines = true;
            ops.UseSmartTags = true;
            DesignerOptionCollection wfd = this.CreateOptionCollection ( options, "WindowsFormsDesigner", null );
            this.CreateOptionCollection ( wfd, "General", ops );
        }
    }//end_class
    
    internal class DesignerOptionServiceExt4Grid : DesignerOptionService {
        private System.Drawing.Size _gridSize;
    
        public DesignerOptionServiceExt4Grid ( System.Drawing.Size gridSize ) : base() { _gridSize = gridSize; }
    
        protected override void PopulateOptionCollection ( DesignerOptionCollection options ) {
            if ( null != options.Parent ) return;
    
            DesignerOptions ops = new DesignerOptions();
            ops.GridSize = _gridSize;
            ops.SnapToGrid = true;
            ops.ShowGrid = true;
            ops.UseSnapLines = false;
            ops.UseSmartTags = true;
            DesignerOptionCollection wfd = this.CreateOptionCollection ( options, "WindowsFormsDesigner", null );
            this.CreateOptionCollection ( wfd, "General", ops );
        }
    }//end_class
    
    internal class DesignerOptionServiceExt4GridWithoutSnapping : DesignerOptionService {
        private System.Drawing.Size _gridSize;
    
        public DesignerOptionServiceExt4GridWithoutSnapping ( System.Drawing.Size gridSize ) : base() { _gridSize = gridSize; }
    
        protected override void PopulateOptionCollection ( DesignerOptionCollection options ) {
            if ( null != options.Parent ) return;
    
            DesignerOptions ops = new DesignerOptions();
            ops.GridSize = _gridSize;
            ops.SnapToGrid = false;
            ops.ShowGrid = true;
            ops.UseSnapLines = false;
            ops.UseSmartTags = true;
            DesignerOptionCollection wfd = this.CreateOptionCollection ( options, "WindowsFormsDesigner", null );
            this.CreateOptionCollection ( wfd, "General", ops );
        }
    }//end_class
    
    internal class DesignerOptionServiceExt4NoGuides : DesignerOptionService {
        public DesignerOptionServiceExt4NoGuides() : base() { }
    
        protected override void PopulateOptionCollection ( DesignerOptionCollection options ) {
            if ( null != options.Parent ) return;
    
            DesignerOptions ops = new DesignerOptions();
            ops.GridSize = new System.Drawing.Size ( 8, 8 );
            ops.SnapToGrid = false;
            ops.ShowGrid = false;
            ops.UseSnapLines = false;
            ops.UseSmartTags = true;
            DesignerOptionCollection wfd = this.CreateOptionCollection ( options, "WindowsFormsDesigner", null );
            this.CreateOptionCollection ( wfd, "General", ops );
        }
    }//end_class
    

    //DesignerSerializationServiceImpl.cs

    internal class DesignerSerializationServiceImpl : IDesignerSerializationService {
    
        private IServiceProvider _serviceProvider;
    
        public DesignerSerializationServiceImpl ( IServiceProvider serviceProvider ) {
            this._serviceProvider = serviceProvider;
        }
    
        public System.Collections.ICollection Deserialize ( object serializationData ) {
            SerializationStore serializationStore = serializationData as SerializationStore;
            if ( serializationStore != null ) {
                ComponentSerializationService componentSerializationService = _serviceProvider.GetService ( typeof ( ComponentSerializationService ) ) as ComponentSerializationService;
                ICollection collection = componentSerializationService.Deserialize ( serializationStore );
                return collection;
            }
            return new object[] {};
        }
    
        public object Serialize ( System.Collections.ICollection objects ) {
            ComponentSerializationService componentSerializationService = _serviceProvider.GetService ( typeof ( ComponentSerializationService ) ) as ComponentSerializationService;
            SerializationStore returnObject = null;
            using ( SerializationStore serializationStore = componentSerializationService.CreateStore() ) {
                foreach ( object obj in objects ) {
                    if ( obj is Control )
                        componentSerializationService.Serialize ( serializationStore, obj );
                }
                returnObject = serializationStore;
            }
            return returnObject;
        }
    
    }//end_class

    //DesignSurfaceExt.cs

    //- this class adds to a .NET 
    //-     DesignSurface instance
    //- the following facilities:
    //-     * TabOrder
    //-     * UndoEngine
    //-     * Cut/Copy/Paste/Delete commands
    //-
    //- DesignSurfaceExt
    //-     |
    //-     +--|DesignSurface|
    //-     |
    //-     +--|TabOrder|
    //-     |
    //-     +--|UndoEngine|
    //-     |
    //-     +--|Cut/Copy/Paste/Delete commands|
    //-
    public class DesignSurfaceExt : DesignSurface, IDesignSurfaceExt {
        private const string _Name_ = "DesignSurfaceExt";
    
        
    
        #region IDesignSurfaceExt Members
    
        public void SwitchTabOrder() {
            if ( false == IsTabOrderMode ) {
                InvokeTabOrder();
            }
            else {
                DisposeTabOrder();
            }
        }
    
        public void UseSnapLines() {
            IServiceContainer serviceProvider = this.GetService ( typeof ( IServiceContainer ) ) as IServiceContainer;
            DesignerOptionService opsService = serviceProvider.GetService ( typeof ( DesignerOptionService ) ) as DesignerOptionService;
            if ( null != opsService ) {
                serviceProvider.RemoveService ( typeof ( DesignerOptionService ) );
            }
            DesignerOptionService opsService2 = new DesignerOptionServiceExt4SnapLines();
            serviceProvider.AddService ( typeof ( DesignerOptionService ), opsService2 );
        }
    
        public void UseGrid ( Size gridSize ) {
            IServiceContainer serviceProvider = this.GetService ( typeof ( IServiceContainer ) ) as IServiceContainer;
            DesignerOptionService opsService = serviceProvider.GetService ( typeof ( DesignerOptionService ) ) as DesignerOptionService;
            if ( null != opsService ) {
                serviceProvider.RemoveService ( typeof ( DesignerOptionService ) );
            }
            DesignerOptionService opsService2 = new DesignerOptionServiceExt4Grid ( gridSize );
            serviceProvider.AddService ( typeof ( DesignerOptionService ), opsService2 );
        }
    
        public void UseGridWithoutSnapping ( Size gridSize ) {
            IServiceContainer serviceProvider = this.GetService ( typeof ( IServiceContainer ) ) as IServiceContainer;
            DesignerOptionService opsService = serviceProvider.GetService ( typeof ( DesignerOptionService ) ) as DesignerOptionService;
            if ( null != opsService ) {
                serviceProvider.RemoveService ( typeof ( DesignerOptionService ) );
            }
            DesignerOptionService opsService2 = new DesignerOptionServiceExt4GridWithoutSnapping ( gridSize );
            serviceProvider.AddService ( typeof ( DesignerOptionService ), opsService2 );
        }
    
        public void UseNoGuides() {
            IServiceContainer serviceProvider = this.GetService ( typeof ( IServiceContainer ) ) as IServiceContainer;
            DesignerOptionService opsService = serviceProvider.GetService ( typeof ( DesignerOptionService ) ) as DesignerOptionService;
            if ( null != opsService ) {
                serviceProvider.RemoveService ( typeof ( DesignerOptionService ) );
            }
            DesignerOptionService opsService2 = new DesignerOptionServiceExt4NoGuides();
            serviceProvider.AddService ( typeof ( DesignerOptionService ), opsService2 );
    
        }
    
        public UndoEngineExt GetUndoEngineExt() {
            return this._undoEngine;
        }
    
        private IComponent CreateRootComponentCore ( Type controlType, Size controlSize, DesignerLoader loader ) {
            const string _signature_ = _Name_ + @"::CreateRootComponentCore()";
            try {
                //- step.1
                //- get the IDesignerHost
                //- if we are not not able to get it 
                //- then rollback (return without do nothing)
                IDesignerHost host = GetIDesignerHost();
                if ( null == host ) return null;
                //- check if the root component has already been set
                //- if so then rollback (return without do nothing)
                if( null != host.RootComponent ) return null;
                //-
                //-
                //- step.2
                //- create a new root component and initialize it via its designer
                //- if the component has not a designer
                //- then rollback (return without do nothing)
                //- else do the initialization
                if( null != loader ) {
                    this.BeginLoad( loader );
                    if( this.LoadErrors.Count > 0 )
                        throw new Exception( _signature_ + " - Exception: the BeginLoad(loader) failed!" );
                }
                else {
                    this.BeginLoad( controlType );
                    if( this.LoadErrors.Count > 0 )
                        throw new Exception( _signature_ + " - Exception: the BeginLoad(Type) failed! Some error during " + controlType.ToString() + " loading" );
                }
                //-
                //-
                //- step.3
                //- try to modify the Size of the object just created
                IDesignerHost ihost = GetIDesignerHost();
                //- Set the backcolor and the Size
                Control ctrl = null;
                if( host.RootComponent is  Form ) {
                    ctrl = this.View as Control;
                    ctrl.BackColor = Color.LightGray;
                    //- set the Size
                    PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties( ctrl );
                    //- Sets a PropertyDescriptor to the specific property
                    PropertyDescriptor pdS = pdc.Find( "Size", false );
                    if( null != pdS )
                        pdS.SetValue( ihost.RootComponent, controlSize );
                }
                else if( host.RootComponent is UserControl ) {
                    ctrl = this.View as Control;
                    ctrl.BackColor = Color.Gray;
                    //- set the Size
                    PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties( ctrl );
                    //- Sets a PropertyDescriptor to the specific property
                    PropertyDescriptor pdS = pdc.Find( "Size", false );
                    if( null != pdS )
                        pdS.SetValue( ihost.RootComponent, controlSize );
                }
                else if(  host.RootComponent is  Control ) {
                    ctrl = this.View as Control;
                    ctrl.BackColor = Color.LightGray;
                    //- set the Size
                    PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties( ctrl );
                    //- Sets a PropertyDescriptor to the specific property
                    PropertyDescriptor pdS = pdc.Find( "Size", false );
                    if( null != pdS )
                        pdS.SetValue( ihost.RootComponent, controlSize );
                }
                else if(  host.RootComponent is  Component ) {
                    ctrl = this.View as Control;
                    ctrl.BackColor = Color.White;
                    //- don't set the Size
                }
                else {
                    //- Undefined Host Type
                    ctrl = this.View as Control;
                    ctrl.BackColor = Color.Red;
                }
    
                return ihost.RootComponent;
            }//end_try
            catch( Exception exx ) {
                Debug.WriteLine( exx.Message );
                if( null != exx.InnerException )
                    Debug.WriteLine( exx.InnerException.Message );
                
                throw;
            }//end_catch
        }
    
        public IComponent CreateRootComponent( Type controlType, Size controlSize ) {
            return CreateRootComponentCore( controlType, controlSize, null );
        }
    
        public IComponent CreateRootComponent( DesignerLoader loader, Size controlSize ) {
            return CreateRootComponentCore( null, controlSize, loader );
        }
        
        public Control CreateControl ( Type controlType, Size controlSize, Point controlLocation ) {
            try {
                //- step.1
                //- get the IDesignerHost
                //- if we are not able to get it 
                //- then rollback (return without do nothing)
                IDesignerHost host = GetIDesignerHost();
                if ( null == host ) return null;
                //- check if the root component has already been set
                //- if not so then rollback (return without do nothing)
                if( null == host.RootComponent ) return null;
                //-
                //-
                //- step.2
                //- create a new component and initialize it via its designer
                //- if the component has not a designer
                //- then rollback (return without do nothing)
                //- else do the initialization
                IComponent newComp = host.CreateComponent ( controlType );
                if ( null == newComp ) return null;
                IDesigner designer = host.GetDesigner ( newComp );
                if ( null == designer ) return null;
                if ( designer is IComponentInitializer )
                    ( ( IComponentInitializer ) designer ).InitializeNewComponent ( null );
                //-
                //-
                //- step.3
                //- try to modify the Size/Location of the object just created
                PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties ( newComp );
                //- Sets a PropertyDescriptor to the specific property.
                PropertyDescriptor pdS = pdc.Find ( "Size", false );
                if ( null != pdS )
                    pdS.SetValue ( newComp, controlSize );
                PropertyDescriptor pdL = pdc.Find ( "Location", false );
                if ( null != pdL )
                    pdL.SetValue ( newComp, controlLocation );
                //-
                //-
                //- step.4
                //- commit the Creation Operation
                //- adding the control to the DesignSurface's root component
                //- and return the control just created to let further initializations
                ( ( Control ) newComp ).Parent = host.RootComponent as Control;
                return newComp as Control;
            }//end_try
            catch( Exception exx ) {
                Debug.WriteLine( exx.Message );
                if( null != exx.InnerException )
                    Debug.WriteLine( exx.InnerException.Message );
                
                throw;
            }//end_catch
        }
    
        public IDesignerHost GetIDesignerHost() {
            return ( IDesignerHost ) ( this.GetService ( typeof ( IDesignerHost ) ) );
        }
    
        public Control GetView() {
            Control ctrl = this.View as Control;
            if( null == ctrl )
                return null;
            ctrl.Dock = DockStyle.Fill;
            return ctrl;
        }
    
        #endregion
    
    
    
        #region TabOrder
        
        private TabOrderHooker _tabOrder = null;
        private bool _tabOrderMode = false;
        
        public bool IsTabOrderMode {
            get { return _tabOrderMode;  }
        }
    
        public TabOrderHooker TabOrder {
            get {
                if ( _tabOrder == null )
                    _tabOrder = new TabOrderHooker();
                return _tabOrder;
            }
            set {  _tabOrder = value;  }
        }
    
        public void InvokeTabOrder() {
            TabOrder.HookTabOrder ( this.GetIDesignerHost() );
            _tabOrderMode = true;
        }
    
        public void DisposeTabOrder() {
            TabOrder.HookTabOrder ( this.GetIDesignerHost() );
            _tabOrderMode = false;
        }
        #endregion
    
    
    
        #region  UndoEngine
    
        private UndoEngineExt _undoEngine = null;
        private NameCreationServiceImp _nameCreationService = null;
        private DesignerSerializationServiceImpl _designerSerializationService = null;
        private CodeDomComponentSerializationService _codeDomComponentSerializationService = null;
    
        #endregion
    
    
    
        #region ctors
    
        //- ctors
        //- Summary:
        //-     Initializes a new instance of the System.ComponentModel.Design.DesignSurface
        //-     class.
        //-
        //- Exceptions:
        //-   System.ObjectDisposedException:
        //-     The System.ComponentModel.Design.IDesignerHost attached to the System.ComponentModel.Design.DesignSurface
        //-     has been disposed.
        public DesignSurfaceExt() : base() { InitServices(); }
        //-
        //- Summary:
        //-     Initializes a new instance of the System.ComponentModel.Design.DesignSurface
        //-     class.
        //-
        //- Parameters:
        //-   parentProvider:
        //-     The parent service provider, or null if there is no parent used to resolve
        //-     services.
        //-
        //- Exceptions:
        //-   System.ObjectDisposedException:
        //-     The System.ComponentModel.Design.IDesignerHost attached to the System.ComponentModel.Design.DesignSurface
        //-     has been disposed.
        public DesignSurfaceExt( IServiceProvider parentProvider ) : base( parentProvider ) { InitServices(); }
        //-
        //- Summary:
        //-     Initializes a new instance of the System.ComponentModel.Design.DesignSurface
        //-     class.
        //-
        //- Parameters:
        //-   rootComponentType:
        //-     The type of root component to create.
        //-
        //- Exceptions:
        //-   System.ArgumentNullException:
        //-     rootComponent is null.
        //-
        //-   System.ObjectDisposedException:
        //-     The System.ComponentModel.Design.IDesignerHost attached to the System.ComponentModel.Design.DesignSurface
        //-     has been disposed.
        public DesignSurfaceExt( Type rootComponentType ) : base( rootComponentType ) { InitServices(); }
        //-
        //- Summary:
        //-     Initializes a new instance of the System.ComponentModel.Design.DesignSurface
        //-     class.
        //-
        //- Parameters:
        //-   parentProvider:
        //-     The parent service provider, or null if there is no parent used to resolve
        //-     services.
        //-
        //-   rootComponentType:
        //-     The type of root component to create.
        //-
        //- Exceptions:
        //-   System.ArgumentNullException:
        //-     rootComponent is null.
        //-
        //-   System.ObjectDisposedException:
        //-     The System.ComponentModel.Design.IDesignerHost attached to the System.ComponentModel.Design.DesignSurface
        //-     has been disposed.
        public DesignSurfaceExt( IServiceProvider parentProvider, Type rootComponentType ) : base( parentProvider, rootComponentType ) { InitServices(); }
    
    
        //- The DesignSurface class provides several design-time services automatically.
        //- The DesignSurface class adds all of its services in its constructor.
        //- Most of these services can be overridden by replacing them in the
        //- protected ServiceContainer property.To replace a service, override the constructor,
        //- call base, and make any changes through the protected ServiceContainer property.
        private void InitServices() {
            //- each DesignSurface has its own default services
            //- We can leave the default services in their present state,
            //- or we can remove them and replace them with our own.
            //- Now add our own services using IServiceContainer
            //-
            //-
            //- Note
            //- before loading the root control in the design surface
            //- we must add an instance of naming service to the service container.
            //- otherwise the root component did not have a name and this caused
            //- troubles when we try to use the UndoEngine
            //-
            //-
            //- 1. NameCreationService
            _nameCreationService = new NameCreationServiceImp();
            if( _nameCreationService != null ) {
                this.ServiceContainer.RemoveService( typeof( INameCreationService ), false );
                this.ServiceContainer.AddService( typeof( INameCreationService ), _nameCreationService );
            }
            //-
            //-
            //- 2. CodeDomComponentSerializationService
            _codeDomComponentSerializationService = new CodeDomComponentSerializationService( this.ServiceContainer );
            if( _codeDomComponentSerializationService != null ) {
                //- the CodeDomComponentSerializationService is ready to be replaced
                this.ServiceContainer.RemoveService( typeof( ComponentSerializationService ), false );
                this.ServiceContainer.AddService( typeof( ComponentSerializationService ), _codeDomComponentSerializationService );
            }
            //-
            //-
            //- 3. IDesignerSerializationService
            _designerSerializationService = new DesignerSerializationServiceImpl( this.ServiceContainer );
            if( _designerSerializationService != null ) {
                //- the IDesignerSerializationService is ready to be replaced
                this.ServiceContainer.RemoveService( typeof( IDesignerSerializationService ), false );
                this.ServiceContainer.AddService( typeof( IDesignerSerializationService ), _designerSerializationService );
            }
            //-
            //-
            //- 4. UndoEngine
            _undoEngine = new UndoEngineExt( this.ServiceContainer );
            //- disable the UndoEngine
            _undoEngine.Enabled = false;
            if( _undoEngine != null ) {
                //- the UndoEngine is ready to be replaced
                this.ServiceContainer.RemoveService( typeof( UndoEngine ), false );
                this.ServiceContainer.AddService( typeof( UndoEngine ), _undoEngine );
            }
            //-
            //-
            //- 5. IMenuCommandService
            this.ServiceContainer.AddService( typeof( IMenuCommandService ), new MenuCommandService( this ) );
        }
        
        #endregion
    
        //- do some Edit menu command using the MenuCommandServiceImp
        public void DoAction( string command ) {
            if( string.IsNullOrEmpty( command ) ) return;
    
            IMenuCommandService ims = this.GetService( typeof( IMenuCommandService ) ) as IMenuCommandService;
            if( null == ims ) return;
    
    
            try {
                switch( command.ToUpper() ) {
                    case "CUT" :
                        ims.GlobalInvoke( StandardCommands.Cut );
                        break;
                    case "COPY" :
                        ims.GlobalInvoke( StandardCommands.Copy );
                        break;
                    case "PASTE":
                        ims.GlobalInvoke( StandardCommands.Paste );
                        break;
                    case "DELETE":
                        ims.GlobalInvoke( StandardCommands.Delete );
                        break;
                    default:
                        // do nothing;
                        break;
                }//end_switch
            }//end_try
            catch( Exception exx ) {
                Debug.WriteLine( exx.Message );
                if( null != exx.InnerException )
                    Debug.WriteLine( exx.InnerException.Message );
    
                throw;
            }//end_catch
        }
     
    }//end_class
    

    //DesignSurfaceExt2.cs

    //- this class adds to
    //-     DesignSurfaceExt instance
    //- the following facilities:
    //-     * Toolbox mechanisms (the ToolBox container must be provided by the user)
    //-     * ContextMenu on DesignSurface with Cut/Copy/Paste/Delete commands
    //-
    //- DesignSurfaceExt2
    //-     |
    //-     +--|Toolbox|
    //-     |
    //-     +--|ContextMenu|
    //-     |
    //-     +--|DesignSurfaceExt|
    //-             |
    //-             +--|DesignSurface|
    //-             |
    //-             +--|TabOrder|
    //-             |
    //-             +--|UndoEngine|
    //-             |
    //-             +--|Cut/Copy/Paste/Delete commands|
    //-
    public class DesignSurfaceExt2 : DesignSurfaceExt, IDesignSurfaceExt2 {
        private const string _Name_ = "DesignSurfaceExt2";
    
    
        #region  IToolboxService
    
        private ToolboxServiceImp _toolboxService = null;
    
        public ToolboxServiceImp GetIToolboxService() {
            return (ToolboxServiceImp) this.GetService( typeof( IToolboxService ) );
        }
    
        #region drag&Drop
        public void EnableDragandDrop() {
            // For the management of the drag and drop of the toolboxItems
            Control ctrl = this.GetView();
            if( null==ctrl )
                return;
            ctrl.AllowDrop = true;
            ctrl.DragDrop += new DragEventHandler( OnDragDrop );
    
            //- enable the Dragitem inside the our Toolbox
            ToolboxServiceImp tbs = this.GetIToolboxService();
            if( null == tbs )
                return;
            if( null == tbs.Toolbox )
                return;
            tbs.Toolbox.MouseDown += new MouseEventHandler( OnListboxMouseDown );
        }
    
    
        //- Management of the Drag&Drop of the toolboxItems contained inside our Toolbox
        private void OnListboxMouseDown( object sender, MouseEventArgs e ) {
            ToolboxServiceImp tbs = this.GetIToolboxService();
            if( null == tbs )
                return;
            if( null == tbs.Toolbox ) 
                return;
            if( null == tbs.Toolbox.SelectedItem ) 
                return;
    
            tbs.Toolbox.DoDragDrop( tbs.Toolbox.SelectedItem, DragDropEffects.Copy | DragDropEffects.Move );
        }
    
        //- Management of the drag and drop of the toolboxItems
        public void OnDragDrop( object sender, DragEventArgs e ) {
            //- if the user don't drag a ToolboxItem 
            //- then do nothing
            if( !e.Data.GetDataPresent( typeof( ToolboxItem ) ) ) {
                e.Effect = DragDropEffects.None;
                return;
            }
            //- now retrieve the data node
            ToolboxItem item = e.Data.GetData( typeof( ToolboxItem ) ) as ToolboxItem;
            e.Effect = DragDropEffects.Copy;
            item.CreateComponents( this.GetIDesignerHost() );
    
        }
        #endregion
    
        #endregion
    
    
        #region  MenuCommandService
        private MenuCommandServiceExt _menuCommandService = null;
        #endregion
    
    
        #region ctors
    
        //- ctors
        //- Summary:
        //-     Initializes a new instance of the System.ComponentModel.Design.DesignSurface
        //-     class.
        //-
        //- Exceptions:
        //-   System.ObjectDisposedException:
        //-     The System.ComponentModel.Design.IDesignerHost attached to the System.ComponentModel.Design.DesignSurface
        //-     has been disposed
        public DesignSurfaceExt2() : base() { InitServices(); }
        //-
        //- Summary:
        //-     Initializes a new instance of the System.ComponentModel.Design.DesignSurface
        //-     class.
        //-
        //- Parameters:
        //-   parentProvider:
        //-     The parent service provider, or null if there is no parent used to resolve
        //-     services.
        //-
        //- Exceptions:
        //-   System.ObjectDisposedException:
        //-     The System.ComponentModel.Design.IDesignerHost attached to the System.ComponentModel.Design.DesignSurface
        //-     has been disposed
        public DesignSurfaceExt2( IServiceProvider parentProvider ) : base( parentProvider ) { InitServices(); }
        //-
        //- Summary:
        //-     Initializes a new instance of the System.ComponentModel.Design.DesignSurface
        //-     class.
        //-
        //- Parameters:
        //-   rootComponentType:
        //-     The type of root component to create
        //-
        //- Exceptions:
        //-   System.ArgumentNullException:
        //-     rootComponent is null.
        //-
        //-   System.ObjectDisposedException:
        //-     The System.ComponentModel.Design.IDesignerHost attached to the System.ComponentModel.Design.DesignSurface
        //-     has been disposed
        public DesignSurfaceExt2( Type rootComponentType ) : base( rootComponentType ) { InitServices(); }
        //-
        //- Summary:
        //-     Initializes a new instance of the System.ComponentModel.Design.DesignSurface
        //-     class.
        //-
        //- Parameters:
        //-   parentProvider:
        //-     The parent service provider, or null if there is no parent used to resolve
        //-     services.
        //-
        //-   rootComponentType:
        //-     The type of root component to create.
        //-
        //- Exceptions:
        //-   System.ArgumentNullException:
        //-     rootComponent is null.
        //-
        //-   System.ObjectDisposedException:
        //-     The System.ComponentModel.Design.IDesignerHost attached to the System.ComponentModel.Design.DesignSurface
        //-     has been disposed.
        public DesignSurfaceExt2( IServiceProvider parentProvider, Type rootComponentType ) : base( parentProvider, rootComponentType ) { InitServices(); }
    
        //- The DesignSurface class provides several design-time services automatically.
        //- The DesignSurface class adds all of its services in its constructor.
        //- Most of these services can be overridden by replacing them in the
        //- protected ServiceContainer property.To replace a service, override the constructor,
        //- call base, and make any changes through the protected ServiceContainer property.
        private void InitServices() {
            //- each DesignSurface has its own default services
            //- We can leave the default services in their present state,
            //- or we can remove them and replace them with our own.
            //- Now add our own services using IServiceContainer
            //-
            //-
            //- 
            _menuCommandService = new MenuCommandServiceExt( this );
            if( _menuCommandService != null ) {
                //- remove the old Service, i.e. the DesignsurfaceExt service
                this.ServiceContainer.RemoveService( typeof( IMenuCommandService ), false );
                //- add the new IMenuCommandService
                this.ServiceContainer.AddService( typeof( IMenuCommandService ), _menuCommandService );
            }
            //-
            //-
            //- IToolboxService
            _toolboxService = new ToolboxServiceImp( this.GetIDesignerHost() );
            if( _toolboxService != null ) {
                this.ServiceContainer.RemoveService( typeof( IToolboxService ), false );
                this.ServiceContainer.AddService( typeof( IToolboxService ), _toolboxService );
            }
    
        }
        
        #endregion
    
    
    }//end_class

    // IDesignSurfaceExt2.cs

       public interface IDesignSurfaceExt2 : IDesignSurfaceExt{
            //- Get the IDesignerHost of the .NET 2.0 DesignSurface
            ToolboxServiceImp GetIToolboxService();
            void EnableDragandDrop();
        }

    // IDesignSurfaceExt.cs

    public interface IDesignSurfaceExt {
    
        //- perform Cut/Copy/Paste/Delete commands
        void DoAction( string command );
    
        //- de/activate the TabOrder facility
        void SwitchTabOrder();
    
        //- select the controls alignement mode
        void UseSnapLines();
        void UseGrid ( System.Drawing.Size gridSize );
        void UseGridWithoutSnapping ( System.Drawing.Size gridSize );
        void UseNoGuides();
    
        //- method usefull to create control without the ToolBox facility
        IComponent CreateRootComponent ( Type controlType, Size controlSize );
        IComponent CreateRootComponent( DesignerLoader loader, Size controlSize );
        Control CreateControl ( Type controlType, Size controlSize, Point controlLocation );
    
        //- Get the UndoEngineExtended object
        UndoEngineExt GetUndoEngineExt();
    
        //- Get the IDesignerHost of the .NET 2.0 DesignSurface
        IDesignerHost GetIDesignerHost();
    
        //- the HostControl of the .NET 2.0 DesignSurface is just a Control
        //- you can manipulate this Control just like any other WinForms Control
        //- (you can dock it and add it to another Control just to display it)
        //- Get the HostControl
        Control GetView();
    
    }//end_interface

  • lundi 23 juillet 2012 03:53
     
      A du code

    Hi all,

    This is in continuation to below mentioned reply:

    //MenuCommandServiceExt.cs

      class MenuCommandServiceExt : IMenuCommandService {
    
            //- this ServiceProvider is the DesignsurfaceExt2 instance 
            //- passed as paramter inside the ctor
            IServiceProvider _serviceProvider = null;
    
            MenuCommandService _menuCommandService = null;
    
            public MenuCommandServiceExt( IServiceProvider serviceProvider ) {
                this._serviceProvider = serviceProvider;
                _menuCommandService = new MenuCommandService( serviceProvider );
            }
            
            public void ShowContextMenu( CommandID menuID, int x, int y ) {
                ContextMenu contextMenu = new ContextMenu();
    
                // Add the standard commands CUT/COPY/PASTE/DELETE
                MenuCommand command = FindCommand( StandardCommands.Cut );
                if( command != null ) {
                    MenuItem menuItem = new MenuItem( "Cut", new EventHandler( OnMenuClicked ) );
                    menuItem.Tag = command;
                    contextMenu.MenuItems.Add( menuItem );
                }
                command = FindCommand( StandardCommands.Copy );
                if( command != null ) {
                    MenuItem menuItem = new MenuItem( "Copy", new EventHandler( OnMenuClicked ) );
                    menuItem.Tag = command;
                    contextMenu.MenuItems.Add( menuItem );
                }
                command = FindCommand( StandardCommands.Paste );
                if( command != null ) {
                    MenuItem menuItem = new MenuItem( "Paste", new EventHandler( OnMenuClicked ) );
                    menuItem.Tag = command;
                    contextMenu.MenuItems.Add( menuItem );
                }
                command = FindCommand( StandardCommands.Delete );
                if( command != null ) {
                    MenuItem menuItem = new MenuItem( "Delete", new EventHandler( OnMenuClicked ) );
                    menuItem.Tag = command;
                    contextMenu.MenuItems.Add( menuItem );
                }
    
                //- Show the contexteMenu
                DesignSurface surface = (DesignSurface) _serviceProvider;
                Control viewService = (Control) surface.View;
                
                if( viewService != null ) {
                    contextMenu.Show( viewService, viewService.PointToClient( new Point( x, y ) ) );
                }
            }
    
            //- Management of the selections of the contexteMenu
            private void OnMenuClicked( object sender, EventArgs e ) {
                MenuItem menuItem = sender as MenuItem;
                if( menuItem != null && menuItem.Tag is MenuCommand ) {
                    MenuCommand command = menuItem.Tag as MenuCommand;
                    command.Invoke();
                }
            }
    
    
            public void AddCommand( MenuCommand command ) {
                _menuCommandService.AddCommand( command );
            }
    
    
            public void AddVerb( DesignerVerb verb ) {
                _menuCommandService.AddVerb( verb );
            }
    
    
            public MenuCommand FindCommand( CommandID commandID ) {
                return _menuCommandService.FindCommand( commandID );
            }
    
    
            public bool GlobalInvoke( CommandID commandID ) {
                return _menuCommandService.GlobalInvoke( commandID );
            }
    
    
            public void RemoveCommand( MenuCommand command ) {
                _menuCommandService.RemoveCommand( command );
            }
    
        
            public void RemoveVerb( DesignerVerb verb ) {
                _menuCommandService.RemoveVerb( verb );
            }
    
    
            public DesignerVerbCollection Verbs {
                get {
                    return _menuCommandService.Verbs;
                }
            }
        }

    // NameCreationServiceImp.cs

    internal class NameCreationServiceImp : INameCreationService {
        private const string _Name_ = "NameCreationServiceImp";
    
        //- ctor
        public NameCreationServiceImp()	{}
    
        public string CreateName ( IContainer container, Type type ) {
            if ( null == container )
                return string.Empty;
    
    
            ComponentCollection cc = container.Components;
            int min = Int32.MaxValue;
            int max = Int32.MinValue;
            int count = 0;
    
            int i = 0;
            while ( i < cc.Count ) {
                Component comp = cc[i] as Component;
    
                if ( comp.GetType() == type )	{
                    count++;
    
                    string name = comp.Site.Name;
                    if ( name.StartsWith ( type.Name ) )	{
                        try	{
                            int value = Int32.Parse ( name.Substring ( type.Name.Length ) );
                            if ( value < min ) min = value;
                            if ( value > max ) max = value;
                        }
                        catch ( Exception ) {}
                    }//end_if
                }//end_if
                i++;
            } //end_while
    
            if ( 0 == count ) {
                return type.Name + "1";
            }
            else if ( min > 1 ) {
                int j = min - 1;
                return type.Name + j.ToString();
            }
            else {
                int j = max + 1;
                return type.Name + j.ToString();
            }
        }
    
        public bool IsValidName ( string name ) {
            //- Check that name is "something" and that is a string with at least one char
            if ( String.IsNullOrEmpty ( name ) )
                return false;
    
            //- then the first character must be a letter
            if ( ! ( char.IsLetter ( name, 0 ) ) )
                return false;
    
            //- then don't allow a leading underscore
            if ( name.StartsWith ( "_" ) )
                return false;
    
            //- ok, it's a valid name
            return true;
        }
    
        public void ValidateName ( string name ) {
            const string _signature_ = _Name_ + @"::ValidateName()";
    
            //-  Use our existing method to check, if it's invalid throw an exception
            if ( ! ( IsValidName ( name ) ) )
                throw new ArgumentException( _signature_ + " - Exception: Invalid name: " + name  );
        }
    
    }//end_class

    //TabOrderHooker.cs

    public class TabOrderHooker {
        private const string _Name_ = "TabOrderHooker";
    
        private object _tabOrder = null;
    
        //- Enables/Disables visual TabOrder on the view.
        //- internal override
        public void HookTabOrder ( IDesignerHost host ) {
            const string _signature_ = _Name_ + @"::ctor()";
    
            //- the TabOrder must be called AFTER the DesignSurface has been loaded
            //- therefore we do a little check
            if ( null == host.RootComponent )
                throw new Exception( _signature_ + " - Exception: the TabOrder must be invoked after the DesignSurface has been loaded!" );
    
            try {
                System.Reflection.Assembly designAssembly = System.Reflection.Assembly.Load ( "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" );
                Type tabOrderType = designAssembly.GetType ( "System.Windows.Forms.Design.TabOrder" );
                if ( _tabOrder == null ) {
                    //- call the ctor passing the IDesignerHost taget object
                    _tabOrder = Activator.CreateInstance ( tabOrderType, new object[] { host } );
                }
                else {
                    DisposeTabOrder();
                }
            }//end_try
            catch( Exception exx ) {
                Debug.WriteLine( exx.Message );
                if( null != exx.InnerException )
                    Debug.WriteLine( exx.InnerException.Message );
    
                throw;
            }//end_catch
        }
    
        
    
        //- Disposes the tab order
        public void DisposeTabOrder() {
            if ( null == _tabOrder ) return;
            try {
                System.Reflection.Assembly designAssembly = System.Reflection.Assembly.Load ( "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" );
                Type tabOrderType = designAssembly.GetType ( "System.Windows.Forms.Design.TabOrder" );
                tabOrderType.InvokeMember ( "Dispose", BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, _tabOrder, new object[] { true } );
                _tabOrder = null;
            }
            catch( Exception exx ) {
                Debug.WriteLine( exx.Message );
                if( null != exx.InnerException )
                    Debug.WriteLine( exx.InnerException.Message );
    
                throw;
            }//end_catch
        }
    
    
    }//end_class

    //ToolboxServiceImp.cs

        //- It is the gateway between the toolbox user interface 
        //- in the development environment and the designers. 
        //- The designers constantly query the toolbox when the 
        //- cursor is  over them to get feedback about the selected control
        //-
        //- NOTE:
        //- this is a lightweight class!
        //- this class implements the interface IToolboxService 
        //- it does NOT create a ListBox, it merely links one
        //- which is created by user and then referenced by 
        //- the ToolboxServiceImp::Toolbox property
        //-
        public class ToolboxServiceImp : IToolboxService {
    
    
            public IDesignerHost DesignerHost { get; private set; }
    
            //- our real Toolbox
            public ListBox Toolbox { get; set; }
    
    
            //- ctor
            public ToolboxServiceImp( IDesignerHost host ){
    			this.DesignerHost = host;
    
    			//- Our MainForm adds our ToolboxPane to the DesignerHost's services.
                Toolbox = null;
    		}
    
    
    
    
            #region IToolboxService Members
    
            //- Add a creator that will convert non-standard tools in the specified format into ToolboxItems, to be associated with a host.
            void IToolboxService.AddCreator( ToolboxItemCreatorCallback creator, string format, IDesignerHost host ) {
                // UNIMPLEMENTED - We aren't handling any non-standard tools here. Our toolset is constant.
                //throw new NotImplementedException();
            }
    
            //- Add a creator that will convert non-standard tools in the specified format into ToolboxItems.
            void IToolboxService.AddCreator( ToolboxItemCreatorCallback creator, string format ) {
                // UNIMPLEMENTED - We aren't handling any non-standard tools here. Our toolset is constant.
                //throw new NotImplementedException();
            }
    
            //- Add a ToolboxItem to our toolbox, in a specific category, bound to a certain host.
            void IToolboxService.AddLinkedToolboxItem( ToolboxItem toolboxItem, string category, IDesignerHost host ) {
                // UNIMPLEMENTED - We didn't end up doing a project system, so there's no need
                // to add custom tools (despite that we do have a tab for such tools).
                //throw new NotImplementedException();
            }
    
            //- Add a ToolboxItem to our toolbox, bound to a certain host.
            void IToolboxService.AddLinkedToolboxItem( ToolboxItem toolboxItem, IDesignerHost host ) {
                // UNIMPLEMENTED - We didn't end up doing a project system, so there's no need
                // to add custom tools (despite that we do have a tab for such tools).
                //throw new NotImplementedException();
            }
    
            //- Add a ToolboxItem to our toolbox under the specified category.
            void IToolboxService.AddToolboxItem( ToolboxItem toolboxItem, string category ) {
                //- we have no category 
                ((IToolboxService) this).AddToolboxItem( toolboxItem );
            }
    
            //- Add a ToolboxItem to our Toolbox.
            void IToolboxService.AddToolboxItem( ToolboxItem toolboxItem ) {
                Toolbox.Items.Add( toolboxItem );
            }
    
    
            //- Our toolbox has categories akin to those of Visual Studio, but you
            //- could group them any which way. Just make sure your IToolboxService knows.
            CategoryNameCollection IToolboxService.CategoryNames {
                get {
                    return null;
                }
            }
    
            //- necessary for the Drag&Drop
            //- We deserialize a ToolboxItem when we drop it onto our design surface.
            //- The ToolboxItem comes packaged in a DataObject. We're just working
            //- with standard tools and one host, so the host parameter is ignored.
            ToolboxItem IToolboxService.DeserializeToolboxItem( object serializedObject, IDesignerHost host ) {
                return ((IToolboxService)this).DeserializeToolboxItem( serializedObject );
            }
    
            //- We deserialize a ToolboxItem when we drop it onto our design surface.
            //- The ToolboxItem comes packaged in a DataObject.
            ToolboxItem IToolboxService.DeserializeToolboxItem( object serializedObject ) {
                return (ToolboxItem) ((DataObject) serializedObject).GetData( typeof( ToolboxItem ) );
            }
    
            //- Return the selected ToolboxItem in our toolbox if it is associated with this host.
            //- Since all of our tools are associated with our only host, the host parameter
            //- is ignored.
            ToolboxItem IToolboxService.GetSelectedToolboxItem( IDesignerHost host ) {
                return ((IToolboxService)this).GetSelectedToolboxItem();
            }
    
            //- Return the selected ToolboxItem in our Toolbox
            ToolboxItem IToolboxService.GetSelectedToolboxItem() {
    
                if( null == Toolbox || null == Toolbox.SelectedItem )
                    return null;
    
                ToolboxItem tbItem = (ToolboxItem) Toolbox.SelectedItem;
                if( tbItem.DisplayName.ToUpper().Contains( "POINTER") ) 
                    return null;
    
    
                return tbItem;
            }
    
            //-  Get all the tools in a category
            ToolboxItemCollection IToolboxService.GetToolboxItems( string category, IDesignerHost host ) {
                //- we have no category
                return ((IToolboxService) this).GetToolboxItems();
            }
    
    
            //- Get all of the tools.
            ToolboxItemCollection IToolboxService.GetToolboxItems( string category ) {
                //- we have no category
                return ((IToolboxService) this).GetToolboxItems();
            }
    
    
            //- Get all of the tools. We're always using our current host though.
            ToolboxItemCollection IToolboxService.GetToolboxItems( IDesignerHost host ) {
                return ((IToolboxService) this).GetToolboxItems();
            }
    
    
            //- Get all of the tools
            ToolboxItemCollection IToolboxService.GetToolboxItems() {
                if( null == Toolbox ) return null;
    
    
                ToolboxItem[] arr = new ToolboxItem[Toolbox.Items.Count];
                Toolbox.Items.CopyTo( arr, 0 );
    
                return new ToolboxItemCollection( arr );
            }
    
            //- We are always using standard ToolboxItems, so they are always supported
            bool IToolboxService.IsSupported( object serializedObject, ICollection filterAttributes ) {
                return true;
            }
    
            //- We are always using standard ToolboxItems, so they are always supported
            bool IToolboxService.IsSupported( object serializedObject, IDesignerHost host ) {
                return true;
            }
    
            //- Check if a serialized object is a ToolboxItem. In our case, all of our tools
            //- are standard and from a constant set, and they all extend ToolboxItem, so if
            //- we can deserialize it in our standard-way, then it is indeed a ToolboxItem
            //- The host is ignored
            bool IToolboxService.IsToolboxItem( object serializedObject, IDesignerHost host ) {
                return ((IToolboxService) this).IsToolboxItem( serializedObject );
            }
    
    
    
            //- Check if a serialized object is a ToolboxItem. In our case, all of our tools
            //- are standard and from a constant set, and they all extend ToolboxItem, so if
            //- we can deserialize it in our standard-way, then it is indeed a ToolboxItem
            bool IToolboxService.IsToolboxItem( object serializedObject ) {
                //- If we can deserialize it, it's a ToolboxItem.
                if( ((IToolboxService) this).DeserializeToolboxItem( serializedObject ) != null )
                    return true;
    
                return false;
            }
    
    
            //- Refreshes the Toolbox
            void IToolboxService.Refresh() {
                Toolbox.Refresh();
            }
    
            //- Remove the creator for the specified format, associated with a particular host.
            void IToolboxService.RemoveCreator( string format, IDesignerHost host ) {
                // UNIMPLEMENTED - We aren't handling any non-standard tools here. Our toolset is constant.
                //throw new NotImplementedException();
            }
    
            //- Remove the creator for the specified format.
            void IToolboxService.RemoveCreator( string format ) {
                // UNIMPLEMENTED - We aren't handling any non-standard tools here. Our toolset is constant.
                //throw new NotImplementedException();
            }
    
            //- Remove a ToolboxItem from the specified category in our Toolbox.
            void IToolboxService.RemoveToolboxItem( ToolboxItem toolboxItem, string category ) {
                ((IToolboxService) this).RemoveToolboxItem( toolboxItem );
            }
    
            //- Remove a ToolboxItem from our Toolbox.
            void IToolboxService.RemoveToolboxItem( ToolboxItem toolboxItem ) {
                if( null == Toolbox ) return ;
    
                Toolbox.SelectedItem = null;
                Toolbox.Items.Remove( toolboxItem );
            }
    
           
            //- If your toolbox is categorized, then it's good for others to know
            //- which category is selected.
            string IToolboxService.SelectedCategory {
                get {
                    return null;
                }
                set {
                    // UNIMPLEMENTED 
                }
            }
    
    
            //- This gets called after our IToolboxUser (the designer) ToolPicked method is called.
            //- In our case, we select the pointer. 
            void IToolboxService.SelectedToolboxItemUsed() {
                if( null == Toolbox ) return;
    
                Toolbox.SelectedItem = null;
            }
    
    
            //- Serialize the toolboxItem necessary for the Drag&Drop
            //- We serialize a toolbox by packaging it in a DataObject
            object IToolboxService.SerializeToolboxItem( ToolboxItem toolboxItem ) {
                //return new DataObject(typeof( ToolboxItem), toolboxItem );
                DataObject dataObject = new DataObject();
                dataObject.SetData( typeof( ToolboxItem ), toolboxItem );
                return dataObject;
            }
    
            //- If we've got a tool selected, then perhaps we want to set our cursor to do
            //- something interesting when its over the design surface. If we do, then
            //- we do it here and return true. Otherwise we return false so the caller
            //- can set the cursor in some default manor.
            bool IToolboxService.SetCursor() {
    
                if(null == Toolbox || null == Toolbox.SelectedItem)
                    return false;
    
    
                //- <Pointer> is not a tool
                ToolboxItem tbItem = (ToolboxItem) Toolbox.SelectedItem;
                if( tbItem.DisplayName.ToUpper().Contains( "POINTER" ) )
                    return false;
    
    
                if( null != Toolbox.SelectedItem ) {
                    Cursor.Current = Cursors.Cross;
                    return true;
                }
    
                return false;
            }
    
            //- Set the selected ToolboxItem in our Toolbox.
            void IToolboxService.SetSelectedToolboxItem( ToolboxItem toolboxItem ) {
                if( null == Toolbox ) 
                    return;
                
                Toolbox.SelectedItem = toolboxItem;
            }
    
            #endregion
    
    
        }

    //UndoEngineExt.cs

    public class UndoEngineExt : UndoEngine {
        private string _Name_ = "UndoEngineExt";
    
        private Stack<UndoEngine.UndoUnit> undoStack = new Stack<UndoEngine.UndoUnit>();
        private Stack<UndoEngine.UndoUnit> redoStack = new Stack<UndoEngine.UndoUnit>();
    
    public UndoEngineExt ( IServiceProvider provider ) : base ( provider ) {}
    
    
        public bool EnableUndo {
            get { return undoStack.Count > 0; }
        }
    
        public bool EnableRedo {
            get { return redoStack.Count > 0; }
        }
    
        public void Undo() {
            if ( undoStack.Count > 0 ) {
                try {
                    UndoEngine.UndoUnit unit = undoStack.Pop();
                    unit.Undo();
                    redoStack.Push ( unit );
                    //Log("::Undo - undo action performed: " + unit.Name);
                }
                catch ( Exception ex ) {
                    Debug.WriteLine( _Name_ + ex.Message );
                    //Log("::Undo() - Exception " + ex.Message + " (line:" + new StackFrame(true).GetFileLineNumber() + ")");
                }
            }
            else {
                //Log("::Undo - NO undo action to perform!");
            }
        }
    
        public void Redo() {
            if ( redoStack.Count > 0 ) {
                try {
                    UndoEngine.UndoUnit unit = redoStack.Pop();
                    unit.Undo();
                    undoStack.Push ( unit );
                    //Log("::Redo - redo action performed: " + unit.Name);
                }
                catch ( Exception ex ) {
                    Debug.WriteLine( _Name_ + ex.Message );
                    //Log("::Redo() - Exception " + ex.Message + " (line:" + new StackFrame(true).GetFileLineNumber() + ")");
                }
            }
            else {
                //Log("::Redo - NO redo action to perform!");
            }
        }
    
    
        protected override void AddUndoUnit ( UndoEngine.UndoUnit unit ) {
            undoStack.Push ( unit );
        }
    
    
    }//end_class

    This is all for the assembly: DesignSurfaceExt

  • lundi 23 juillet 2012 04:12
     
      A du code

    This is for class : DesignSurfaceManagerExt

    //DesignSurfaceManagerExt.cs

    public class DesignSurfaceManagerExt : DesignSurfaceManager {
        private const string _Name_ = "DesignSurfaceManagerExt";
    
        //- this List<> is necessary to be able to delete the DesignSurfaces previously created
        //- Note: 
        //-     the DesignSurfaceManager.DesignSurfaces Property is a collection of design surfaces 
        //-     that are currently hosted by the DesignSurfaceManager but is readonly
        private List<DesignSurfaceExt2> DesignSurfaceExt2Collection = new List<DesignSurfaceExt2>();
    
        public PropertyGridHost PropertyGridHost { get;  private set; }
    
    
        #region ctors
        //- ctors
        // Summary:
        //     Initializes a new instance of the System.ComponentModel.Design.DesignSurfaceManager
        //     class.
        public DesignSurfaceManagerExt() : base() { Init();  }
        //
        // Summary:
        //     Initializes a new instance of the System.ComponentModel.Design.DesignSurfaceManager
        //     class.
        //
        // Parameters:
        //   parentProvider:
        //     A parent service provider. Service requests are forwarded to this provider
        //     if they cannot be resolved by the design surface manager.
        public DesignSurfaceManagerExt( IServiceProvider parentProvider ) : base( parentProvider ) { Init(); }
        //-
        private void Init(){
            this.PropertyGridHost = new PropertyGridHost( this );
            //- add the PropertyGridHost and ComboBox as services
            //- to let them available for every DesignSurface
            //- (the DesignSurface need a PropertyGridHost/ComboBox not a the UserControl hosting them so
            //- we provide the PropertyGridHost/ComboBox embedded inside our UserControl PropertyGridExt)
            this.ServiceContainer.AddService( typeof( PropertyGrid ), PropertyGridHost.PropertyGrid );
            this.ServiceContainer.AddService( typeof( ComboBox ), PropertyGridHost.ComboBox );
      
            
            this.ActiveDesignSurfaceChanged += ( object sender, ActiveDesignSurfaceChangedEventArgs e ) =>
            {
                DesignSurfaceExt2 surface = e.NewSurface as DesignSurfaceExt2;
                if( null == surface )
                    return;
    
                UpdatePropertyGridHost( surface );
            };
        }
    
        public void UpdatePropertyGridHost( DesignSurfaceExt2 surface ) {
            IDesignerHost host = (IDesignerHost) surface.GetService( typeof( IDesignerHost ) );
            if( null == host)
                return;
            if( null == host.RootComponent ) 
                return;
    
            //- sync the PropertyGridHost
            this.PropertyGridHost.SelectedObject = host.RootComponent;
            this.PropertyGridHost.ReloadComboBox();
        }
    
        #endregion
    
        //- The CreateDesignSurfaceCore method is called by both CreateDesignSurface methods
        //- It is the implementation that actually creates the design surface
        //- The default implementation just returns a new DesignSurface, we override 
        //- this method to provide a custom object that derives from the DesignSurface class
        //- i.e. a new DesignSurfaceExt2 instance
        protected override DesignSurface CreateDesignSurfaceCore( IServiceProvider parentProvider ) {
            return new DesignSurfaceExt2( parentProvider );
        }
    
        
    
        //- Gets a new DesignSurfaceExt2 
        //- and loads it with the appropriate type of root component. 
        public DesignSurfaceExt2 CreateDesignSurfaceExt2() {
            //- with a DesignSurfaceManager class, is useless to add new services 
            //- to every design surface we are about to create,
            //- because of the "IServiceProvider" parameter of CreateDesignSurface(IServiceProvider) Method.
            //- This param let every design surface created 
            //- to use the services of the DesignSurfaceManager.
            //- A new merged service provider will be created that will first ask 
            //- this provider for a service, and then delegate any failures 
            //- to the design surface manager object. 
            //- Note:
            //-     the following line of code create a brand new DesignSurface which is added 
            //-     to the Designsurfeces collection, 
            //-     i.e. the property "this.DesignSurfaces" ( the .Count in incremented by one)
            DesignSurfaceExt2 surface = (DesignSurfaceExt2) (this.CreateDesignSurface( this.ServiceContainer ));
    
            
            //- each time a brand new DesignSurface is created,
            //- subscribe our handler to its SelectionService.SelectionChanged event
            //- to sync the PropertyGridHost
            ISelectionService selectionService = (ISelectionService)(surface.GetService(typeof(ISelectionService)));
            if( null != selectionService ) {
                selectionService.SelectionChanged += ( object sender, EventArgs e ) =>
                {
                    ISelectionService selectService = sender as ISelectionService;
                    if( null == selectService )
                        return;
    
                    if( 0 == selectService.SelectionCount )
                        return;
    
                    //- Sync the PropertyGridHost
                    PropertyGrid propertyGrid = (PropertyGrid) this.GetService( typeof( PropertyGrid ) );
                    if( null == propertyGrid )
                        return;
    
                    ArrayList comps = new ArrayList();
                    comps.AddRange( selectService.GetSelectedComponents() );
                    propertyGrid.SelectedObjects = comps.ToArray();
                };
            }
            DesignSurfaceExt2Collection.Add( surface );
            this.ActiveDesignSurface = surface;
    
            //- and return the DesignSurface (to let the its BeginLoad() method to be called)
            return surface;
        }
    
        public void DeleteDesignSurfaceExt2(DesignSurfaceExt2 item) {
            DesignSurfaceExt2Collection.Remove( item );
            try {
                item.Dispose();
            }
            catch( Exception ex) {
                System.Diagnostics.Debug.WriteLine( ex.Message );
            }
            int currentIndex = DesignSurfaceExt2Collection.Count - 1;
            if( currentIndex >= 0 )
                ActiveDesignSurface = DesignSurfaceExt2Collection[currentIndex];
            else
                ActiveDesignSurface = null;
        }
    
        public void DeleteDesignSurfaceExt2( int index  ) {
            DesignSurfaceExt2 item = DesignSurfaceExt2Collection[index];
            DesignSurfaceExt2Collection.RemoveAt( index );
            try {
                item.Dispose();
            }
            catch( Exception ex ) {
                System.Diagnostics.Debug.WriteLine( ex.Message );
            }
            int currentIndex = DesignSurfaceExt2Collection.Count - 1;
            if( currentIndex >= 0 )
                ActiveDesignSurface = DesignSurfaceExt2Collection[currentIndex];
            else
                ActiveDesignSurface = null;
        }
    
    
        //- loop through all the collection of DesignSurface 
        //- to find out a brand new Form name
        public string GetValidFormName() {
            //- we choose to use "Form_" with an underscore char as trailer 
            //- because the .NET design services provide a name of type: "FormN"
            //- with N=1,2,3,4,...
            //- therefore using a "Form", without an underscore char as trailer,
            //- cause some troubles when we have to decide if a name is used or not
            //- using a different building pattern (with the underscore) avoid this issue
            string newFormNameHeader  = "Form_";
            int newFormNametrailer = -1;
            string newFormName = string.Empty;
            bool isNew = true;
            do {
                isNew = true;
                newFormNametrailer++;
                newFormName = newFormNameHeader + newFormNametrailer;
                foreach( DesignSurfaceExt2 item in DesignSurfaceExt2Collection ) {
                    string currentFormName = item.GetIDesignerHost().RootComponent.Site.Name;
                    isNew &= ((newFormName == currentFormName) ? false : true);
                }//end_foreach
                
            } while( !isNew ); 
            return newFormName;
        }
    
    
    
    
    
        public new DesignSurfaceExt2 ActiveDesignSurface {
            get { return base.ActiveDesignSurface as DesignSurfaceExt2; }
            set { base.ActiveDesignSurface = value; }
        }
           
    }//end_class

    //PropertyGridHost.cs

    public partial class PropertyGridHost : UserControl {
        private const string _Name_ = "PropertyGridHost";
    
    
        //- used to suppress events, 
        //- set it to True before changing a property that will cause an event to be raised
        private bool _bSuppressEvents = false;
    
        private DesignSurfaceManagerExt SurfaceManager { get;  set;}
        public ComboBox ComboBox { get{return pgrdComboBox;} }
    	public PropertyGrid PropertyGrid{ get{return pgrdPropertyGrid;} }
    	public object SelectedObject{
    		get	{ return pgrdPropertyGrid.SelectedObject;}
    		set	{ pgrdPropertyGrid.SelectedObject = value;}
    	}
        
        //- ctor
        public PropertyGridHost(DesignSurfaceManagerExt surfaceManager) {
            const string _signature_ = _Name_ + @"::ctor()";
    
            InitializeComponent();
            this.Dock = DockStyle.Fill;
    
            //- the surface manager strictly tied with PropertyGridHost
            if( null == surfaceManager )
                throw new ArgumentNullException( "surfaceManager", _signature_ + " - Exception: invalid argument (null)!" );
    
            SurfaceManager = surfaceManager;
    
            pgrdPropertyGrid.ToolbarVisible = true;
            pgrdPropertyGrid.HelpVisible = true;
    
    
            //- the ComboBox is an OBSERVER of PropertyGridHost event: SelectedObjectsChanged
            //- everytime someone select a new object inside the PropertyGridHost
            //-                     |
            //-                     +---> the event PropertyGridHost.SelectedObjectsChanged is fired
            //-                                                                              |
            //-                           the ReloadComboBox() method is called <------------+
            //- 
            //-
            //-
            //- 
            pgrdPropertyGrid.SelectedObjectsChanged += ( object sender, System.EventArgs e ) =>
            {
                ReloadComboBox();
            };
    
    
            //- the PropertyGridHost is an OBSERVER of ComboBox event: SelectedIndexChanged
            //- everytime someone select a new object inside the ComboBox
            //-                     |
            //-                     +---> the event ComboBox.SelectedIndexChanged is fired
            //-                                                                         |
            //-     the OrientPropertyGridTowardsObject() method is called <------------+
            //- 
            //-
            pgrdComboBox.SelectedIndexChanged += ( object sender, System.EventArgs e )=>
            {
                if( _bSuppressEvents )
                    return;
                OrientPropertyGridTowardsObject();
            };
        }
    
    
        private string TranslateComponentToName( Component comp ) {
            string sType = comp.GetType().ToString();
            if( string.IsNullOrEmpty( sType ) )
                return string.Empty;
            if( string.IsNullOrEmpty( comp.Site.Name ) )
                return string.Empty;
    
            sType = sType.Substring( sType.LastIndexOf( "." ) + 1 );
            return String.Format( "({0}) {1}", sType,comp.Site.Name );
        }
    
    
        //- rely on SurfaceManager.ActiveDesignSurface
        //- which effectively points to ACTIVE DesignSurface
        private void OrientPropertyGridTowardsObject() {
            //- IDesignerEventService provides a global eventing mechanism for designer events. With this mechanism,
            //- an application is informed when a designer becomes active. The service provides a collection of
            //- designers and a single place where global objects, such as the Properties window, can monitor selection
            //- change events.
            IDesignerEventService des = (IDesignerEventService) SurfaceManager.GetService( typeof( IDesignerEventService ) );
            if( null == des )
                return;
            IDesignerHost host = des.ActiveDesigner;
    
    
            //- get the ISelectionService from the active Designsurface
    		//- and if we are not able to get it then it'sType better to exit
            ISelectionService iSel = host.GetService( typeof( ISelectionService ) ) as ISelectionService;
    		if (iSel == null)
    			return;
    
    		//- get the name of the control selected from the comboBox
    		//- and if we are not able to get it then it's better to exit
    		string sName = pgrdComboBox.SelectedItem.ToString();
    		if (string.IsNullOrEmpty(sName))
    			return;
    
    
            //- save the collection of objects currently selected
          
    
    		//- loop through the controls inside the current Designsurface
    		//- if we find the one selected into the comboBox then 
    		//- use the ISelectionService to select it 
    		//- (and this will select it into the PropertyGridHost)
            ComponentCollection ctrlsExisting = host.Container.Components;
            Debug.Assert( 0 != ctrlsExisting.Count );
            foreach( Component comp in ctrlsExisting ) {
                string sItemText = TranslateComponentToName( comp );
    			if ( sName == sItemText){
                    Component[] arr = { comp };
    				//- ISelectionService in action...
                    iSel.SetSelectedComponents( arr );
                    //this.SelectedObject = arr[0];
                    break;
    			}
    		}//end_foreach
    
    	}
    
    
        //- realy on SurfaceManager.ActiveDesignSurface
        //- which effectively points to ACTIVE DesignSurface
        public void ReloadComboBox() {
            _bSuppressEvents = true;
            try {
                //- IDesignerEventService provides a global eventing mechanism for designer events. With this mechanism,
                //- an application is informed when a designer becomes active. The service provides a collection of
                //- designers and a single place where global objects, such as the Properties window, can monitor selection
                //- change events.
                IDesignerEventService des = (IDesignerEventService) SurfaceManager.GetService( typeof( IDesignerEventService ) );
                if( null == des )
                    return;
                IDesignerHost host = des.ActiveDesigner;
    
    
                object selectedObj = pgrdPropertyGrid.SelectedObject;
                if( null == selectedObj )
                    return; //- don't reload at all
    
    
                //- get the name of the control selected from the comboBox
                //- and if we are not able to get it then it's better to exit
                string sName = string.Empty;
                if( selectedObj is Form ) {
                    sName = ((Form) selectedObj).Name;
                }
                else if( selectedObj is Control ) {
                    sName = ((Control) selectedObj).Site.Name;
                }
                if( string.IsNullOrEmpty( sName ) )
                    return;
    
    
    
                //- prepare the data for reloading the combobox (begin)
                List<object> ctrlsToAdd = new List<object>();
                string pgrdComboBox_Text = string.Empty;
                try {
                    ComponentCollection ctrlsExisting = host.Container.Components;
                    Debug.Assert( 0 != ctrlsExisting.Count );
    
    
                    foreach( Component comp in ctrlsExisting ) {
                        string sItemText = TranslateComponentToName( comp );
                        ctrlsToAdd.Add( sItemText );
                        if( sName == comp.Site.Name )
                            pgrdComboBox_Text = sItemText;
                    }//end_foreach
                }
                catch( Exception ) {
                    return; //- (rollback)
                }
                //- update the combobox (commit)
                pgrdComboBox.Items.Clear();
                pgrdComboBox.Items.AddRange( ctrlsToAdd.ToArray() );
                pgrdComboBox.Text = pgrdComboBox_Text;
            }
            finally {
                _bSuppressEvents = false;
            }
        }
    
    
        //- collapse the single GridItem 
        //- the one which has label equal to param "sGridItemLabel"
        public GridItem CollapseGridItem( string sGridItemLabel ) {
            return CollapseExpandGridItem(sGridItemLabel, false);
        }
        //- expand the single GridItem 
        //- the one which has label equal to param "sGridItemLabel"
        public GridItem ExpandGridItem( string sGridItemLabel ) {
            return CollapseExpandGridItem(sGridItemLabel, true);
        }
    
        private GridItem CollapseExpandGridItem( string sGridItemLabel, bool bExpanded ) {
            //- retrieve the root GridItem
            GridItem root = this.PropertyGrid.SelectedGridItem;
            if( null == root )
                return null;
    
            while( null != root.Parent )
                root = root.Parent;
           
            if( null == root ) 
                return null;
    
            //- and begin to search from the root
            foreach( GridItem g in root.GridItems ) {
                if( g.Label == sGridItemLabel ) {
                    if( g.Expandable )
                        g.Expanded = bExpanded;
                    return g;
                }//end_if
            }//end_for
            return null;
        }
          
           
    }//end_class

    Continuation of last class:

     partial class PropertyGridHost {
            /// <summary> 
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.IContainer components = null;
    
            /// <summary> 
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
            protected override void Dispose( bool disposing ) {
                if( disposing && (components != null) ) {
                    components.Dispose();
                }
                base.Dispose( disposing );
            }
    
            #region Component Designer generated code
    
            /// <summary> 
            /// Required method for Designer support - do not modify 
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent() {
                this.pgrdPropertyGrid = new System.Windows.Forms.PropertyGrid();
                this.pgrdComboBox = new System.Windows.Forms.ComboBox();
                this.SuspendLayout();
                // 
                // pgrdPropertyGrid
                // 
                this.pgrdPropertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
                this.pgrdPropertyGrid.Location = new System.Drawing.Point( 0, 24 );
                this.pgrdPropertyGrid.Name = "pgrdPropertyGrid";
                this.pgrdPropertyGrid.Size = new System.Drawing.Size( 203, 298 );
                this.pgrdPropertyGrid.TabIndex = 3;
                // 
                // pgrdComboBox
                // 
                this.pgrdComboBox.Dock = System.Windows.Forms.DockStyle.Top;
                this.pgrdComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                this.pgrdComboBox.FormattingEnabled = true;
                this.pgrdComboBox.Location = new System.Drawing.Point( 0, 0 );
                this.pgrdComboBox.Name = "pgrdComboBox";
                this.pgrdComboBox.Size = new System.Drawing.Size( 203, 24 );
                this.pgrdComboBox.TabIndex = 2;
                // 
                // PropertyGridHost
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF( 8F, 16F );
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.Controls.Add( this.pgrdPropertyGrid );
                this.Controls.Add( this.pgrdComboBox );
                this.Name = "PropertyGridHost";
                this.Size = new System.Drawing.Size( 203, 322 );
                this.ResumeLayout( false );
    
            }
    
            #endregion
    
            protected System.Windows.Forms.PropertyGrid pgrdPropertyGrid;
            protected System.Windows.Forms.ComboBox pgrdComboBox;
    
        }

  • lundi 23 juillet 2012 04:17
     
      A du code

    This is for :pDesigner.dll

    //IpDesigner.cs

    using DesignSurfaceExt; using DesignSurfaceManagerExt; public enum AlignmentModeEnum : int { SnapLines = 0, Grid, GridWithoutSnapping, NoGuides }; //- Interface used to //- * hosts: Toolbox;DesignSurfaces;PropertyGrid //- * add/remove DesignSurfaces //- * perform editing actions on active DesignSurface //- public interface IpDesigner { //- controls accessing section ----------------------------------------------------------- //- +-------------+-----------------------------+-----------+ //- |toolboxItem1 | ____ ____ ____ | | //- |toolboxItem2 ||____|____|____|___________ +-----------+ //- |toolboxItem3 || | | | | //- | || | | | | //- | TOOLBOX || DESIGNSURFACES | | PROPERTY | //- | || | | GRID | //- | ||__________________________| | | | //- +-------------+-----------------------------+-----------+ ListBox Toolbox { get; set; } //- TOOLBOX TabControl TabControlHostingDesignSurfaces { get; } //- DESIGNSURFACES HOST PropertyGridHost PropertyGridHost { get; } //- PROPERTYGRID //- DesignSurfaces management section ----------------------------------------------------- DesignSurfaceExt2 ActiveDesignSurface { get; } //- Create the DesignSurface and the rootComponent (a .NET Control) //- using IDesignSurfaceExt.CreateRootComponent() //- if the alignmentMode doesn't use the GRID, then the gridSize param is ignored //- Note: //- the generics param is used to know which type of control to use as RootComponent //- TT is requested to be derived from .NET Control class DesignSurfaceExt2 AddDesignSurface<TT>( int startingFormWidth, int startingFormHeight, AlignmentModeEnum alignmentMode, Size gridSize ) where TT : Control; void RemoveDesignSurface ( DesignSurfaceExt2 activeSurface ); //- Editing section ---------------------------------------------------------------------- void UndoOnDesignSurface(); void RedoOnDesignSurface(); void CutOnDesignSurface(); void CopyOnDesignSurface(); void PasteOnDesignSurface(); void DeleteOnDesignSurface(); void SwitchTabOrder(); }//end_interface

    } // for namespace

    //pDesigner.cs
     //- [Note FROM MSDN]:
        //- The DesignSurfaceManager.ActiveDesignSurface property should be set
        //- by the designer's Type user interface
        //- whenever a designer becomes the active window!
        //- That is to say:
        //-   the DesignSurfaceManagerExt is an OBSERVER of UI event: SelectedTab/SelectedIndex Changed
        //- usage:
        //       //- SelectedIndexChanged event fires when the TabControls SelectedIndex or SelectedTab value changes.
        //       //- give the focus to the DesigneSurface accordingly to te selected TabPage and sync the propertyGrid
        //       this.tabControl1.SelectedIndexChanged += ( object sender, EventArgs e ) => {
        //            TabControl tabCtrl = sender as TabControl;
        //            DesignSurfaceManagerExtObject.ActiveDesignSurface = (DesignSurfaceExt2) DesignSurfaceManagerExtObject.DesignSurfaces[tabCtrl.SelectedIndex];
        //       };
        //-
        //- p(ico)Designer class
        public partial class pDesigner : UserControl , IpDesigner {
            private const string _Name_ = "pDesigner";
    
    
    
    
            //- the DesignSurfaceManagerExt instance must be an OBSERVER
            //- of the UI event which change the active DesignSurface
            //- DesignSurfaceManager is exposed as public getter properties as test facility
            public DesignSurfaceManagerExt DesignSurfaceManager { get; private set; }
    
    
    
            #region ctors
            //- usage:
            //-         if (a){
            //-             // do work
            //-         }//end_if
            //-         else{
            //-             // a is not valid
            //-         }//end_else
            public static implicit operator bool ( pDesigner d ) {
                bool isValid = true;
                //- the object 'd' must be correctly initialized
                isValid &= ( ( null == d.Toolbox ) ? false : true );
                return isValid;
            }
    
    
            //- ctor
            public pDesigner() {
                InitializeComponent();
    
                DesignSurfaceManager = new DesignSurfaceManagerExt();
                DesignSurfaceManager.PropertyGridHost.Parent = this.splitterpDesigner.Panel2;
    
                Toolbox = null;
                this.Dock = DockStyle.Fill;
                           
            }
            #endregion
    
    
            private void tbCtrlpDesigner_SelectedIndexChanged ( object sender, EventArgs e ) {
                TabControl tabCtrl = sender as TabControl;
                int index = this.tbCtrlpDesigner.SelectedIndex;
                if ( index >= 0 )
                    DesignSurfaceManager.ActiveDesignSurface = ( DesignSurfaceExt2 ) DesignSurfaceManager.DesignSurfaces[index];
                else {
                    DesignSurfaceManager.ActiveDesignSurface = null;
                    DesignSurfaceManager.PropertyGridHost.PropertyGrid.SelectedObject = null;
                    DesignSurfaceManager.PropertyGridHost.ComboBox.Items.Clear();
                }
            }
    
    
    
    
    
    
    
            #region IpDesigner Members
    
            //- to get and set the real Toolbox which is provided by the user
            public ListBox Toolbox { get; set; }
    
            public TabControl TabControlHostingDesignSurfaces {
                get { return this.tbCtrlpDesigner; }
            }
    
            public PropertyGridHost PropertyGridHost {
                get { return DesignSurfaceManager.PropertyGridHost; }
            }
    
            public DesignSurfaceExt2 ActiveDesignSurface {
                get { return DesignSurfaceManager.ActiveDesignSurface as DesignSurfaceExt2; }
            }
    
            //- Create the DesignSurface and the rootComponent (a .NET Control)
            //- using IDesignSurfaceExt.CreateRootComponent() 
            //- if the alignmentMode doesn't use the GRID, then the gridSize param is ignored
            //- Note:
            //-     the generics param is used to know which type of control to use as RootComponent
            //-     TT is requested to be derived from .NET Control class 
            public DesignSurfaceExt2 AddDesignSurface<TT> (
                                                            int startingFormWidth, int startingFormHeight,
                                                            AlignmentModeEnum alignmentMode, Size gridSize
                                                           ) where TT : Control {
                const string _signature_ = _Name_ + @"::AddDesignSurface<>()";
    
                if( !this )
                    throw new Exception( _signature_ + " - Exception: " + _Name_ + " is not initialized! Please set the Property: IpDesigner::Toolbox before calling any methods!" );
    
    
                //- step.0
                //- create a DesignSurface
                DesignSurfaceExt2 surface = DesignSurfaceManager.CreateDesignSurfaceExt2();
                this.DesignSurfaceManager.ActiveDesignSurface = surface;
                //-
                //-
                //- step.1
                //- choose an alignment mode...
                switch( alignmentMode ) {
                    case AlignmentModeEnum.SnapLines:
                        surface.UseSnapLines();
                        break;
                    case AlignmentModeEnum.Grid:
                        surface.UseGrid( gridSize );
                        break;
                    case AlignmentModeEnum.GridWithoutSnapping:
                        surface.UseGridWithoutSnapping( gridSize );
                        break;
                    case AlignmentModeEnum.NoGuides:
                        surface.UseNoGuides();
                        break;
                    default:
                        surface.UseSnapLines();
                        break;
                }//end_switch
                //-
                //-
                //- step.2
                //- enable the UndoEngine
                ((IDesignSurfaceExt) surface).GetUndoEngineExt().Enabled = true;
                //-
                //-
                //- step.3
                //- Select the service IToolboxService
                //- and hook it to our ListBox
                ToolboxServiceImp tbox = ((IDesignSurfaceExt2) surface).GetIToolboxService() as ToolboxServiceImp;
                //- we don't check if Toolbox is null because the very first check: if(!this)...
                if( null != tbox )
                    tbox.Toolbox = this.Toolbox;
                //-
                //-
                //- step.4
                //- create the Root compoment, in these cases a Form
                Control rootComponent = null;
                //- cast to .NET Control because the TT object 
                //- has a constraint: to be a ".NET Control"
                rootComponent = surface.CreateRootComponent( typeof( TT ), new Size( startingFormWidth, startingFormHeight ) ) as Control;
                //- rename the Sited component
                //- (because the user may add more then one Form
                //- and every new Form will be called "Form1"
                //- if we don't set its Name)
                rootComponent.Site.Name = this.DesignSurfaceManager.GetValidFormName();
                //-
                //-
                //- step.5
                //- enable the Drag&Drop on RootComponent
                ((DesignSurfaceExt2) surface).EnableDragandDrop();
                //-
                //-
                //- step.6
                //- IComponentChangeService is marked as Non replaceable service
                IComponentChangeService componentChangeService = (IComponentChangeService) (surface.GetService( typeof( IComponentChangeService ) ));
                if( null != componentChangeService ) {
                    //- the Type "ComponentEventHandler Delegate" Represents the method that will
                    //- handle the ComponentAdding, ComponentAdded, ComponentRemoving, and ComponentRemoved
                    //- events raised for component-level events
                    componentChangeService.ComponentChanged += ( Object sender, ComponentChangedEventArgs e )=>
                    {
                        // do nothing
                    };
                    componentChangeService.ComponentAdded += ( Object sender, ComponentEventArgs e )=>
                    {
                        DesignSurfaceManager.UpdatePropertyGridHost( surface );
                    };
                    componentChangeService.ComponentRemoved += ( Object sender, ComponentEventArgs e )=>
                    {
                        DesignSurfaceManager.UpdatePropertyGridHost( surface );
                    };
                }
                //-
                //-
                //- step.7
                //- now set the Form::Text Property
                //- (because it will be an empty string
                //- if we don't set it)
                Control view = surface.GetView();
                if( null == view )
                    return null;
                PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties( view );
                //- Sets a PropertyDescriptor to the specific property
                PropertyDescriptor pdS = pdc.Find( "Text", false );
                if( null != pdS )
                    pdS.SetValue( rootComponent, rootComponent.Site.Name + " (design mode)" );
                //-
                //-
                //- step.8
                //- display the DesignSurface
                string sTabPageText = rootComponent.Site.Name;
                TabPage newPage = new TabPage( sTabPageText );
                newPage.Name = sTabPageText;
                newPage.SuspendLayout(); //----------------------------------------------------
                view.Dock = DockStyle.Fill;
                view.Parent = newPage; //- Note this assignment
                this.tbCtrlpDesigner.TabPages.Add( newPage );
                newPage.ResumeLayout(); //-----------------------------------------------------
                //- select the TabPage created
                this.tbCtrlpDesigner.SelectedIndex = this.tbCtrlpDesigner.TabPages.Count - 1;
                //-
                //-
                //- step.9
                //- finally return the DesignSurface created to let it be modified again by user
                return surface;
            }
                
    
            public void RemoveDesignSurface( DesignSurfaceExt2 surfaceToErase ) {
                try {
    
                    //- remove the TabPage which has the same name of
                    //- the RootComponent host by DesignSurface "surfaceToErase"
                    //- Note:
                    //-     DesignSurfaceManager continues to reference the DesignSurface erased
                    //-     that Designsurface continue to exist but it is no more reachable
                    //-     this fact is usefull when generate new names for Designsurfaces just created
                    //-     avoiding name clashing
                    string dsRootComponentName = surfaceToErase.GetIDesignerHost().RootComponent.Site.Name;
                    TabPage tpToRemove = null;
                    foreach ( TabPage tp in this.tbCtrlpDesigner.TabPages ) {
                        if ( tp.Name == dsRootComponentName ) {
                            tpToRemove = tp;
                            break;
                        }//end_if
                    }//end_foreach
                    if ( null != tpToRemove )
                        this.tbCtrlpDesigner.TabPages.Remove ( tpToRemove );
    
    
                    //- now remove the DesignSurface
                    this.DesignSurfaceManager.DeleteDesignSurfaceExt2 ( surfaceToErase );
    
    
                    //- finally the DesignSurfaceManager remove the DesignSurface
                    //- AND set as active DesignSurface the last one
                    //- therefore we set as active the last TabPage
                    this.tbCtrlpDesigner.SelectedIndex = this.tbCtrlpDesigner.TabPages.Count - 1;
                }//end_try
                catch( Exception exx ) {
                    Debug.WriteLine( exx.Message );
                    if( null != exx.InnerException )
                        Debug.WriteLine( exx.InnerException.Message );
                    
                    throw;
                }//end_catch
            }
    
            public void UndoOnDesignSurface() {
                IDesignSurfaceExt2 isurf = DesignSurfaceManager.ActiveDesignSurface;
                if ( null != isurf )
                    isurf.GetUndoEngineExt().Undo();
            }
    
            public void RedoOnDesignSurface() {
                IDesignSurfaceExt2 isurf = DesignSurfaceManager.ActiveDesignSurface;
                if ( null != isurf )
                    isurf.GetUndoEngineExt().Redo();
            }
    
            public void CutOnDesignSurface() {
                IDesignSurfaceExt isurf = DesignSurfaceManager.ActiveDesignSurface;
                if ( null != isurf )
                    isurf.DoAction ( "Cut" );
            }
    
            public void CopyOnDesignSurface() {
                IDesignSurfaceExt isurf = DesignSurfaceManager.ActiveDesignSurface;
                if ( null != isurf )
                    isurf.DoAction ( "Copy" );
            }
    
            public void PasteOnDesignSurface() {
                IDesignSurfaceExt isurf = DesignSurfaceManager.ActiveDesignSurface;
                if ( null != isurf )
                    isurf.DoAction ( "Paste" );
            }
    
            public void DeleteOnDesignSurface() {
                IDesignSurfaceExt isurf = DesignSurfaceManager.ActiveDesignSurface;
                if ( null != isurf )
                    isurf.DoAction ( "Delete" );
            }
    
            public void SwitchTabOrder() {
                IDesignSurfaceExt isurf = DesignSurfaceManager.ActiveDesignSurface;
                if ( null != isurf )
                    isurf.SwitchTabOrder();
            }
            
            #endregion
    
        }//end_class

    Partial continuation

     partial class pDesigner {
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.IContainer components = null;
    
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose ( bool disposing ) {
        if ( disposing && ( components != null ) ) {
            components.Dispose();
        }
        base.Dispose ( disposing );
    }
    
    #region Component Designer generated code
    
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent() {
        this.splitterpDesigner = new System.Windows.Forms.SplitContainer();
        this.tbCtrlpDesigner = new System.Windows.Forms.TabControl();
        this.splitterpDesigner.Panel1.SuspendLayout();
        this.splitterpDesigner.SuspendLayout();
        this.SuspendLayout();
        //
        // splitterpDesigner
        //
        this.splitterpDesigner.Dock = System.Windows.Forms.DockStyle.Fill;
        this.splitterpDesigner.Location = new System.Drawing.Point ( 0, 0 );
        this.splitterpDesigner.Name = "splitterpDesigner";
        //
        // splitterpDesigner.Panel1
        //
        this.splitterpDesigner.Panel1.Controls.Add ( this.tbCtrlpDesigner );
        this.splitterpDesigner.Size = new System.Drawing.Size ( 635, 305 );
        this.splitterpDesigner.SplitterDistance = 439;
        this.splitterpDesigner.TabIndex = 0;
        //
        // tbCtrlpDesigner
        //
        this.tbCtrlpDesigner.Dock = System.Windows.Forms.DockStyle.Fill;
        this.tbCtrlpDesigner.Location = new System.Drawing.Point ( 0, 0 );
        this.tbCtrlpDesigner.Name = "tbCtrlpDesigner";
        this.tbCtrlpDesigner.SelectedIndex = 0;
        this.tbCtrlpDesigner.Size = new System.Drawing.Size ( 439, 305 );
        this.tbCtrlpDesigner.TabIndex = 0;
        this.tbCtrlpDesigner.SelectedIndexChanged += new System.EventHandler ( this.tbCtrlpDesigner_SelectedIndexChanged );
        //
        // pDesigner
        //
        this.AutoScaleDimensions = new System.Drawing.SizeF ( 8F, 16F );
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.Controls.Add ( this.splitterpDesigner );
        this.Name = "pDesigner";
        this.Size = new System.Drawing.Size ( 635, 305 );
        this.splitterpDesigner.Panel1.ResumeLayout ( false );
        this.splitterpDesigner.ResumeLayout ( false );
        this.ResumeLayout ( false );
    
    }
    
    #endregion
    
    private System.Windows.Forms.SplitContainer splitterpDesigner;
    private System.Windows.Forms.TabControl tbCtrlpDesigner;
        }

  • mercredi 25 juillet 2012 00:38
     
      A du code

    This is the resource file:

    <?xml version="1.0" encoding="utf-8"?>
    <root>
      <!-- 
        Microsoft ResX Schema 
        
        Version 2.0
        
        The primary goals of this format is to allow a simple XML format 
        that is mostly human readable. The generation and parsing of the 
        various data types are done through the TypeConverter classes 
        associated with the data types.
        
        Example:
        
        ... ado.net/XML headers & schema ...
        <resheader name="resmimetype">text/microsoft-resx</resheader>
        <resheader name="version">2.0</resheader>
        <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
        <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
        <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
        <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
        <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
            <value>[base64 mime encoded serialized .NET Framework object]</value>
        </data>
        <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
            <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
            <comment>This is a comment</comment>
        </data>
                    
        There are any number of "resheader" rows that contain simple 
        name/value pairs.
        
        Each data row contains a name, and value. The row also contains a 
        type or mimetype. Type corresponds to a .NET class that support 
        text/value conversion through the TypeConverter architecture. 
        Classes that don't support this are serialized and stored with the 
        mimetype set.
        
        The mimetype is used for serialized objects, and tells the 
        ResXResourceReader how to depersist the object. This is currently not 
        extensible. For a given mimetype the value must be set accordingly:
        
        Note - application/x-microsoft.net.object.binary.base64 is the format 
        that the ResXResourceWriter will generate, however the reader can 
        read any of the formats listed below.
        
        mimetype: application/x-microsoft.net.object.binary.base64
        value   : The object must be serialized with 
                : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
                : and then encoded with base64 encoding.
        
        mimetype: application/x-microsoft.net.object.soap.base64
        value   : The object must be serialized with 
                : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
                : and then encoded with base64 encoding.
    
        mimetype: application/x-microsoft.net.object.bytearray.base64
        value   : The object must be serialized into a byte array 
                : using a System.ComponentModel.TypeConverter
                : and then encoded with base64 encoding.
        -->
      <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
        <xsd:element name="root" msdata:IsDataSet="true">
          <xsd:complexType>
            <xsd:choice maxOccurs="unbounded">
              <xsd:element name="metadata">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="value" type="xsd:string" minOccurs="0" />
                  </xsd:sequence>
                  <xsd:attribute name="name" use="required" type="xsd:string" />
                  <xsd:attribute name="type" type="xsd:string" />
                  <xsd:attribute name="mimetype" type="xsd:string" />
                  <xsd:attribute ref="xml:space" />
                </xsd:complexType>
              </xsd:element>
              <xsd:element name="assembly">
                <xsd:complexType>
                  <xsd:attribute name="alias" type="xsd:string" />
                  <xsd:attribute name="name" type="xsd:string" />
                </xsd:complexType>
              </xsd:element>
              <xsd:element name="data">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                    <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
                  </xsd:sequence>
                  <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
                  <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
                  <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
                  <xsd:attribute ref="xml:space" />
                </xsd:complexType>
              </xsd:element>
              <xsd:element name="resheader">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                  </xsd:sequence>
                  <xsd:attribute name="name" type="xsd:string" use="required" />
                </xsd:complexType>
              </xsd:element>
            </xsd:choice>
          </xsd:complexType>
        </xsd:element>
      </xsd:schema>
      <resheader name="resmimetype">
        <value>text/microsoft-resx</value>
      </resheader>
      <resheader name="version">
        <value>2.0</value>
      </resheader>
      <resheader name="reader">
        <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
      </resheader>
      <resheader name="writer">
        <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
      </resheader>
      <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <value>17, 17</value>
      </metadata>
      <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      <data name="ToolStripMenuItemCut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>
            iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
            YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAGHSURBVDhPrdNNS0JREAbgfk3QpkVRCUUSFrUQFJSrEIRZ
            pKWULSIlsgJTMD+SpF0tLIS6hhZIKBalkJmkUdqiL1OxTMFoXfCWV5BcdLlRsznDYeY5A8Opq/vvuEje
            wen247v7kHnGJumtufvx3ZdiCabVjZpici+A8FmcGVCW7Wsk/EcRqiFfKEGmmkX68ZE5sOM9hvlrimwu
            j2A4DpFEiaenHHPgIHSOJbsD2x4f1AsW9EtGmTeXx05nnzE1b8HwxByIgTHoDKbfAWVEoTaBkEyCkBsQ
            PE0yBzKFDxhdbxDr01h03IKniUGoTcC6lUIkUaSHUvl3DNpeIdbdgyN1gD+6BqEmBN5MEj0KH5Y3Kpv5
            MYyuEgh9Dl0jHrSLbFAtusGbjlabWISNHhDrs9WCNoGZygXaa+okfVdo5CjpAUKXogq8oRRa+HoqH7de
            olO6jYaOIdQ3NNEDqpUbsKUkmvlGsLmV3QciGbD6FGjplsK1H6MHDqM5cGXraO2Vw7l7wnx1f/nRn6qq
            3+OKoLtvAAAAAElFTkSuQmCC
    </value>
      </data>
      <data name="ToolStripMenuItemCopy.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>
            iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
            YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAHiSURBVDhPpZPRT5JRGMb9U0rHnHXtH9BaWa0222pe1EVb
            2briQq+6atlsyzVstIkhzcLSAfahtJbS0mESaQaJlIGTzBkslPEpiSDor+87LAnawM13e+7O+3uf55z3
            VFUdtBwT31AljQeELCNe+hwfCC//Yl9stbm0zMMerrc9J7i4XBliHwsU9ed2dunqf4PTHeBSS2dliGXU
            JwDOEEifwR+WeWh+jTQpY5tIYHUleDKaQD8UFwquZIpd9Tk8ew4y2znkjTSRWFIASqt9YJX6Zje+hfUC
            xGRziXO97m10IzK3pZ+0Pg3T/3btP0CLMYZjSuZo0zCf5uN5iEHJq+beTGVZTaRYiqzzNbyG6VVUADqk
            nJBfmXpFF+VI00vqLgxS2/gsD1DzbqWze5O1phA3DF94YF0qciD/zrKwsoV7bgOjNIPm3OMCQE6mmf8e
            wxeM4PH/YPzjIm29+ee9NZBEa4hy+X6I83dmhYzSNJoz3QVA/emrlKpVPysAWSVeLJFlLrzJmFfG/i7O
            o0EPNQ368jtyrX1KAP6d/NdBt+091Sd05QEXb7pIZXYwDXnpsc9gfDEtJqvNBsskh4/fKw9o0DqV27YK
            1Taa0ZztoeZUF9UnO5XmDg4du1t5zff1mQ566A8dAOcMIXbZrQAAAABJRU5ErkJggg==
    </value>
      </data>
      <data name="ToolStripMenuItemPaste.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>
            iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
            YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJQSURBVDhPtZNZSJRhFIZ/6MJuihbqqquC6CaKCKqLjMIs
            TDOMxIysiRiVEpXJ0iE1NUUnt0nTxshlUHOrRFEpEiFxaNdwjBaJ1Mhpsuafcc/i6f8/GWxo86YDL+fm
            vM9Z+D5J+h/R2ZxB+81UGssSmBe/oTIPt8pyjuCwVTFmu8ZgXzZntb7kpeu4YtBjTI/7FagaJ+V6pp11
            TDqqMRfrGB+pICclihdd8Zw/7U+8ZjO2zmOMtK4mOmy/J0QFqOZpZw1FGUfptmQjvy9guE/PW8sJmkoC
            CQ/1pipxFU/zJCIP7/ME1FXkzALkGxgSw0jWhaCPCuZcZBA6bSAxGn8iQn3Ij14jACF+3p6A6lIDU3It
            U3YT40OZ2J9HYa1YLtRbvozu4kU8MnoJsyqfbRs9AWZTBhP2MiYG0hh/eYqxZweRmxeTW95KpqmRC5dr
            iTeYiUktITzBSFhsliegtDCV0UEjY31aRh/747q/iY+3VwizO6ZnvuFwTjIw7CA4IoWA4/o5SEluEvKr
            NFwPfXF1rMfZtpLBckl0VqP0VqeQqaad3n6bMN/tsrInSDMLKcxK4HPPGZzt65BblmKv96L/uiTG/jrz
            nS8upfMHB71vbFh63uEXGoOvYt619wDe23cg5V+Mw/4gQjEv4VPDQoYqF2AtkohWdlbHdk9wVZmgwNxG
            U4dVZFVbN6xFupQcKx6I+8rurFUO9nPne5bXwlx/p5ua1idzAHWN3KSTygsLRBO0m4CdWwRZvba6s7vb
            77KY4E9xSLm2WvAvzeuz/a3oB0747y0N60d/AAAAAElFTkSuQmCC
    </value>
      </data>
      <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>
            AAABAAkAMDAQAAAAAABoBgAAlgAAACAgEAAAAAAA6AIAAP4GAAAQEBAAAAAAACgBAADmCQAAMDAAAAEA
            CACoDgAADgsAACAgAAABAAgAqAgAALYZAAAQEAAAAQAIAGgFAABeIgAAMDAAAAEAIACoJQAAxicAACAg
            AAABACAAqBAAAG5NAAAQEAAAAQAgAGgEAAAWXgAAKAAAADAAAABgAAAAAQAEAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAIAAAAAAAACAgACAAAAAgACAAICAAADAwMAAgICAAAAA/wAA/wAAAP//AP8A
            AAD/AP8A//8AAP///wAiIiIiKAAAAAAAAAAAAAAAAAAAAAAAAAAiIiIiiIiIiIiIiIgIB3d3d3d3d3d3
            d3AiIiIih///9/d3eIiAB3d//////////3AiIiIih////3d3h4gIB3d//////////3AiIiIih///9/d3
            eIiAB3d//////////3AiIiIih////3d3h4gIB3d//////////3AiIiIih///9/d3eIiAB3d/////////
            /3AiIiIih////3d3h4gIB3d//////////3AiIiIih///9/d3eIiAB3d//////////3AiIiIih////3d3
            h4gIB3d//////////3AiIiIih///9/d3eIiAB3d//////////3AiIiIih////3d3h4gIB3d/////////
            /3AiIiIih///9/d3eIiAB3d//////////3AiIiIih////3d3h4gIB3d//////////3AiIiIih///9/d3
            eIiAB3d//////////3AiIiIih////3d3h4gIB3d3/////////3AiIiIih///9/d3eIiAB3d3////////
            /3AiIiIoiIiIiIiIAAAAAHd3/////////3AiIiIof///9/d3h4iIAHd3/////////3AiIiIof////3d3
            eHiAgHd3/////////3AiIiIof///9/d3h4iIAHd3/////////3AiIiIof////3d3eHiAgHd3////////
            /3AiIiIof///9/d3h4iIAHd//////////3AiIiIiiIiIiIiIiIiIB3f//////////3AiIiIiKHRsxAED
            d3cwB3f//////////3AiIiIiKEbMQBEHP7tzB3d//////////3AiIiIiJGzEAREHc/u3MHd3////////
            /3AiIiIiRsxAEZEHdz+7cwd3f////////3AiIiIkbMQBmREHd/P7tzB3d////////3AiIiJGzEBxkZEH
            d/8/s4gHd3//////93AiIiRsxAdxmREHd//zN3eAd3f/////d3AiIoeAQHdxkZEHd///h/94B3d////3
            d3AiIPd4CHdxmREHd///+HeAAHd///93d3AigPeAKHfxkZEHd////4gAAAf///d3d3AoAAACKH/xmREH
            d/////gAgAD//3d3d3CACAAiKP/xEREHd/////+ACIj/93d3d3CIgAIiKP/4d4gHd//////4iP//d3d3
            d3AigCIiKP/493gHd//////////3d3d3d3AiIiIiKP/493gHd//////////wAAAAAAAiIiIiKP/4iIgH
            d//////////4////eAIiIiIiKP/4AAAHd//////////4///3gCIiIiIiKP/4AAAHd//////////4//94
            AiIiIiIiKP/4AAAP///////////4//eAIiIiIiIiKP/4CAgP///////////4/3gCIiIiIiIiKP/4h4cP
            ///////////494AiIiIiIiIiKP/////////////////4eAIiIiIiIiIiKP/////////////////4gCIi
            IiIiIiIiKIiIiIiIiIiIiIiIiIiIgiIiIiL/gAAAAAAAAP8AAAAAAAAA/wAAAAAAAAD/AAAAAAAAAP8A
            AAAAAAAA/wAAAAAAAAD/AAAAAAAAAP8AAAAAAAAA/wAAAAAAAAD/AAAAAAAAAP8AAAAAAAAA/wAAAAAA
            AAD/AAAAAAAAAP8AAAAAAAAA/wAAAAAAAAD/AAAAAAAAAP8AAAAAAAAA/gAAAAAAAAD+AAAAAAAAAP4A
            AAAAAAAA/gAAAAAAAAD+AAAAAAAAAP4AAAAAAAAA/wAAAAAAAAD/gAAAAAAAAP+AAAAAAAAA/4AAAAAA
            AAD/AAAAAAAAAP4AAAAAAAAA/AAAAAAAAAD4AAAAAAAAAPAAAAAAAAAA4AAAAAAAAADAgAAAAAAAAIGA
            AAAAAAAAA4AAAAAAAAAHgAAAAAAAAM+AAAAAAAAA/4AAAAAAAAD/gAAAAAEAAP+AAAAAAwAA/4AAAAAH
            AAD/gAAAAA8AAP+AAAAAHwAA/4AAAAA/AAD/gAAAAH8AAP+AAAAA/wAA/4AAAAH/AAAoAAAAIAAAAEAA
            AAABAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAICAAIAAAACAAIAAgIAAAMDA
            wACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////ACIiIiAAAAAAAAAAAAAAAAAiIiKIiIiIiIB3
            d3d3d3dwIiIih/f3eHgAd3//////cCIiIof/d3eIgHd//////3AiIiKH9/d4eAB3f/////9wIiIih/93
            d4iAd3//////cCIiIof393h4AHd//////3AiIiKH/3d3iIB3f/////9wIiIih/f3eHgAd3//////cCIi
            Iof/d3eIgHd//////3AiIiKH9/d4eAB3d/////9wIiIoiIiIiAAAB3f/////cCIiKH///3d4eAd3////
            /3AiIih/f3d3h4gHd/////9wIiIof///93h4B3//////cCIiIoiIiIiIiHf//////3AiIiKEREEDdzB3
            f/////9wIiIiRsSRBztzB3f/////cCIiJGxBkQdztzB3f////3AiIkbEcZEHfzuIB3f///9wIihwR3GR
            B3/zd4B3f//3cCKPgIdxkQd//4+AB3//d3AoAAKH8ZEHf//4AAD/93dwhwAij/GBB3///wCA/3d3cCgC
            Io/4eAd////wD/d3d3AiIiKP+PgHf//////wAAAAIiIij/iIB3//////+P94AiIiIo/wAAd///////j3
            gCIiIiKP8AAP///////4eAIiIiIij/gID///////+IAiIiIiIo////////////gCIiIiIiKIiIiIiIiI
            iIiIIiIi/gAAAPwAAAD8AAAA/AAAAPwAAAD8AAAA/AAAAPwAAAD8AAAA/AAAAPwAAAD4AAAA+AAAAPgA
            AAD4AAAA/AAAAPwAAAD8AAAA+AAAAPAAAADgAAAAwAAAAIQAAAAMAAAAnAAAAPwAAAD8AAAB/AAAA/wA
            AAf8AAAP/AAAH/wAAD8oAAAAEAAAACAAAAABAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            gAAAAAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////ACKA
            AAAAAAAAKH/3iAd3d3Aof/d4B3//cCh/94gHf/9wKH/3eAd//3Aod3eIB3//cIf/93eAf/9wiIiIiIB/
            /3AihEE7B3//cCJMCROwd/9wKHB5FzsH93CIB/kX+AB3cICP+If/DwAAIo/3h///j4Iij/AH//+IIiKI
            iIiIiIIiwAAih4AAeHiAAH//gAD/cIAAIoeAAHeIAAB//wAA/3DAACKHwAB4eIAAd/8AAP9wAAAoiMAB
            iADAA3f/wAf/cCgAAAAwAAAAYAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADMa
            DQA1HBAAKysDADIpDgAzMwAALCwVADUnFAA0NRcAJycnADckJAA5NSMAMzMzAFUAAABFKBkAVSsVAE0z
            GgBQMBsAQyYjAFUrKwBINSUAVzcnAGAwIAAxTxwAAmgDABBpDQAHcQsAF2oSAA16FAATdhYALWgdADpU
            KgArbCIATEwAAFFDLgBkRSkAR3A4AHdgMQAFDXAADCN7ACUofgBMOnsAQkZBAH5NTABQcE4AZ3lcAFF8
            YABmZmYAfXBnAIAAAAC/ZhkAkFY9ANZwAADgegAAgU5OAIVSUgCSX18AtFRLAIpiUgC8YlEAhll2AJhp
            aACLanwAnWN1AKFuagC9aWYAp3RtAKNufQCleXMAsHtxAMFoTgDBbFYAyXdTAMFuZADGd2MAw3p2ABOE
            HgAajigAI5s0ACehOwAtqEUAMaxIADKxSwA6u1YAXI5FAGGSRwBPtVUAVolrAG+RbABQrHEAPcJbAD/G
            YABFzGYAZNV1AFbgewD1jwAA2Yc1AOeVOAD9qDEAv5FRAJWacwC/i20ArIF8ALaDdACStGUAqbVyANqR
            QwDPiFYA0oZVAM2WWADXlFsA5JVBAO6hRwD3pkMA/7BEAP61VADTjWoA2ppjAMmHeQDFknsA2Zt5ANKq
            cADmpG0A/7xmAOeodADtsHoA8rp6AIXNdwCwwngA/8B0AAoehQAKJYgAFCiGAAgwiwARMYkADiySAAo8
            lwARN5kALzqLABQ9pAATQpkAPkaKAApGpAAWSKwAH1KuABlMswAXVrkAKFasAANquQBHTpUAX2KFAGhk
            kgAeXMMAFGzIACBjygA7a8IANHbHACNr0gAkdtoAJn7iAIR4igCqeIgAwX6BAAAAAABinIMAZ6qHAHSL
            swAxg88AKILnAC2L8QAwkfcACrb1AC6y5wBNjdUAaYLAAEiX7gAAy/4AFdD/ACbS/gAz1f8AU9v+AHfj
            /wCRh4AApoyEALOIhQC1k4sAqpqQALqwhwC2orQAxoaFAMmZhQDZmIoAyZiRANCdlQD8nZ0A2aaFAMqk
            lADTppYA2LKZAOOthwDnsokA8rmFAOCskAD/oJ8A67eQAPC2kADUpqUAzLOpANW5qQDZubQA/ainAOO6
            oQD4sasA47yzAP2zswC5yIAA+cWLAOrDmwD5xZUA99WZANvFrgDow6gA98ymAO3QrwD906kA6M22APjK
            uQDq07gA/dm3APzptwCuusQAkef+ALHt/gDNzc0A1dXVAObLygD+y8cA7dXBAPzXxQDo2NMA/NzUAP7j
            yAD988IA6+TdAP7r1wDP9f4A5+flAPPs5gD98ucA6fr/AP37+QAAAAAABBR5ABMQbQACBm0AAQEBAQEB
            AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
            AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBATAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
            MDAwMDAwAQEBAQEBAQEBAQEBOTk5ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODc3LDcwAQEBAQEB
            AQEBAQEBOezt7e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3t7e3t2zcwAQEBAQEwMDABAQEBOer19fLy
            8vLy8vLy8uXl5eXl5eXl5eXl4eHh4eHh4eHf7TgwAQEBATC3tzEwAQEBOer19fXy8vLy8vLy8vLy5eXl
            5eXl5eXl5eHh4eHh4eHf7TgwAQEBMLemWlgtAQEBPur19fX18vLy8vLy8vLy8uXl5eXl5eXl5eXh4eHh
            4eHf7TgwAQEwt6ZRTh0fAQEBPuv19fX19fLy8vLy8vLy8vLl5eXl5eXl5eXl4eHh4eHh7TgwATC3plFO
            HRkcAQEBPuv19fX19fXy8vLy8vLy8vLy5eXl5eXl5eXl5eHh4eHh7TgwMLdaT04dGRkBAQEBPuv19fX1
            9fX19fLy8vLy8vLy8uXl5eXl5eXl5eXh4eHhzTgwt1pPTh0ZGQEBAQEBPuv19fX19fX19fXy8vLy8vLy
            8vLl5eXl5eXl5eXl4eF+ez63VE9OGRkZAQEBAQEBPuv19fX19fX19fX18vLy8vLy8vLy5eXl5eXl5eXl
            4X17el1TT04ZGRkBAQEBAQEBPuv59fX19fX19fX19fLy8vLy8vLy8uXl5eXl5eXbfXtqXVNPHRkZGQEB
            AQEBAQEBQ+v5+fn19fX19fX19fXy8vLy8vLy8vLl5eXl5c19e4BdU08dGRkZAQEBAQEBAQEBQ+v5+fn5
            9fX19fX19fX18vLy8vLy8vLy5eXlfn19Xl1TTx0ZGRkBAQEBAQEBAQEBQ+v5+fn5+fX19fX19fX19fLy
            8vLy8vLy8uF+fWpfXFNPHRkZIQEBAQEBAQEBAQEBRuv5+fn5+fn19fX19fX19fXy8vLy8vLf2359al9c
            U08dGRkhAQEBAQEBAQEBAQEBRuv5+fn5+fn59fX19fX19fX18vLy8uV+fn2AXVxRTh0ZGR8wAQEBAQEB
            AQEBAQEBaOv5+fn5+fn5+fX19fX19fX19fLy335+SUleVFFOHRkZJT4wAQEBAQEBAQEBAQEBaPf5+fn5
            +fn5+fn19fX19fX19eXKfn51bW9vUU4dGRlW1z4wAQEBAQEBAQEBAQEBaPf5+fn5+fn5+fn59fX19fXy
            28p+fUy/3ubhZB0ZGVbt1z4wAQEBAQEBAQEBAQEBaPf7+/n5+fn5+fn5+fX19d/Kyn53vtL1z8jhbyYZ
            auXt1z4wAQEBAQEBAQEBAQEBd/f7+/v5+fn5+fn5+fnyysrKeb7P9dJMOjptSTq88vLt0z4wAQEBAQEB
            AQEBAQEBd/f7+/v7+fn5+fn59dvKysl3z/Dsvjo8Okc8PNTy8vLt0z4wAQEBAQEBAQEBAQEBd/f7+/v7
            +/n5+fnl28rKecLs8L9JSUlJSTx38vLy8vLt0z4wAQEBAQEBAQEBAQEBePf7+/v7+/v59dvbyr8ovfDP
            d29vb21JPHfy8vLy8vLt0z4wAQEBAQEBAQEBAQEBePf7+/v7+/nl29vKlyeHKEy+vkzUfW08d/X18vLy
            8vLt00UwAQEBAQEBAQEBAQEBePf7+/v79eHb27qHhIknJydMvkJM3jx39fX19fLy8vLt00UwAQEBAQEB
            AQEBAQEBwPf7+/v75dvbmIWNhIqEJycnokxMQnf19fX19fXy8vLt00UwAQEBAQEBAQEBAQEBwPf7+/v7
            +cWWi4uNm5uQhCcnhblCd/X19fX19fX18vLt00UwAQEBAQEBAQEBAQEBwPf7+/v76J2WlpSrqp+akISQ
            hSei+fX19fX19fX19fLt00UwAQEBAQEBAQEBAQEBxPj7+/v2sayUkJufqqupk5qQhJj5+fn19fX19fX1
            9fXt00UwAQEBAQEBAQEBAQEBxPv7+/u0sbGsj4+Tn6qqqp+Tr/n5+fn59fX19fX19fXt00UwAQEBAQEB
            AQEBAQEBxPv7+/axsbGxsZWJk5+pq6uw+fn5+fn5+fX19fX19fXtw0UwAQEBAQEBAQEBAQEByPv7+7Sx
            sbGxsbGsiZCan7D7+fn5+fn5+fn19fX19fXtw0UwAQEBAQEBAQEBAQEByPv7+7GxsbGxsbGxsZWPnfv7
            +fn5+fn5+fn19fX19fXtw0UwAQEBAQEBAQEBAQEByPv79rGxsbGxsbGxsbGt+/v7+/n5+fn5+fn59fX1
            9fXtw0UwAQEBAQEBAQEBAQEByfv79rGxsbGxsbGxtbP7+/v7+/n5+fn5+fn519fX09PTw7kwAQEBAQEB
            AQEBAQEByfv79rGxsbGxsbSx+/v7+/v7+/v5+fn5+fm+ubm5ubm5Qz4wAQEBAQEBAQEBAQEBzfv7+7Gx
            sbK1tvv7+/v7+/v7+/v7+fn5+flDdGBgYDY1Mz4BAQEBAQEBAQEBAQEBzfv7+7Kxsenotvv7+/v7+/v7
            +/v7+/n5+flD23RjY2NrPgEBAQEBAQEBAQEBAQEBzfv7+7Wx+/v29vv7+/v7+/v7+/v7+/v5+flD4XR0
            Y2s+AQEBAQEBAQEBAQEBAQEB2/v7++i0+/v7+/v7+/v7+/v7+/v7+/v7+flG5nx0bz4BAQEBAQEBAQEB
            AQEBAQEB2/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/lG5nx2RQEBAQEBAQEBAQEBAQEBAQEB2/v7+/v7
            +/v7+/v7+/v7+/v7+/v7+/v7+/to5n1FAQEBAQEBAQEBAQEBAQEBAQEB2/v7+/v7+/v7+/v7+/v7+/v7
            +/v7+/j4+Pho5T4BAQEBAQEBAQEBAQEBAQEBAQEB2+Xl4eHf39/e3tTU1NTUx8fHx8bGxcXFxcFougEB
            AQEBAQEBAQEBAQEBAQEBAQEB////////AAD///////8AAIAAAAAP/wAAAAAAAA//AAAAAAAAD48AAAAA
            AAAPBwAAAAAAAA4HAAAAAAAADAcAAAAAAAAIBwAAAAAAAAAPAAAAAAAAAB8AAAAAAAAAPwAAAAAAAAB/
            AAAAAAAAAP8AAAAAAAAB/wAAAAAAAAP/AAAAAAAAB/8AAAAAAAAP/wAAAAAAAA//AAAAAAAAD/8AAAAA
            AAAP/wAAAAAAAA//AAAAAAAAD/8AAAAAAAAP/wAAAAAAAA//AAAAAAAAD/8AAAAAAAAP/wAAAAAAAA//
            AAAAAAAAD/8AAAAAAAAP/wAAAAAAAA//AAAAAAAAD/8AAAAAAAAP/wAAAAAAAA//AAAAAAAAD/8AAAAA
            AAAP/wAAAAAAAA//AAAAAAAAD/8AAAAAAAAP/wAAAAAAAA//AAAAAAAAH/8AAAAAAAA//wAAAAAAAH//
            AAAAAAAA//8AAAAAAAH//wAAAAAAA///AAAAAAAH//8AAAAAAA///wAAKAAAACAAAABAAAAAAQAIAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMxoNADUcEAArKwMAMikOADMzAAAsLBUANScUADQ1
            FwAnJycANyQkADk1IwAzMzMAVQAAAEUoGQBVKxUATTMaAFAwGwBDJiMAVSsrAEg1JQBXNycAYDAgADFP
            HAACaAMAEGkNAAdxCwAXahIADXoUABN2FgAtaB0AOlQqACtsIgBMTAAAUUMuAGRFKQBHcDgAd2AxAAUN
            cAAMI3sAJSh+AEw6ewBCRkEAfk1MAFBwTgBneVwAUXxgAGZmZgB9cGcAgAAAAL9mGQCQVj0A1nAAAOB6
            AACBTk4AhVJSAJJfXwC0VEsAimJSALxiUQCGWXYAmGloAItqfACdY3UAoW5qAL1pZgCndG0Ao259AKV5
            cwCwe3EAwWhOAMFsVgDJd1MAwW5kAMZ3YwDDenYAE4QeABqOKAAjmzQAJ6E7AC2oRQAxrEgAMrFLADq7
            VgBcjkUAYZJHAE+1VQBWiWsAb5FsAFCscQA9wlsAP8ZgAEXMZgBk1XUAVuB7APWPAADZhzUA55U4AP2o
            MQC/kVEAlZpzAL+LbQCsgXwAtoN0AJK0ZQCptXIA2pFDAM+IVgDShlUAzZZYANeUWwDklUEA7qFHAPem
            QwD/sEQA/rVUANONagDammMAyYd5AMWSewDZm3kA0qpwAOakbQD/vGYA56h0AO2wegDyunoAhc13ALDC
            eAD/wHQACh6FAAoliAAUKIYACDCLABExiQAOLJIACjyXABE3mQAvOosAFD2kABNCmQA+RooACkakABZI
            rAAfUq4AGUyzABdWuQAoVqwAA2q5AEdOlQBfYoUAaGSSAB5cwwAUbMgAIGPKADtrwgA0dscAI2vSACR2
            2gAmfuIAhHiKAKp4iADBfoEAAAAAAGKcgwBnqocAdIuzADGDzwAogucALYvxADCR9wAKtvUALrLnAE2N
            1QBpgsAASJfuAADL/gAV0P8AJtL+ADPV/wBT2/4Ad+P/AJGHgACmjIQAs4iFALWTiwCqmpAAurCHALai
            tADGhoUAyZmFANmYigDJmJEA0J2VAPydnQDZpoUAyqSUANOmlgDYspkA462HAOeyiQDyuYUA4KyQAP+g
            nwDrt5AA8LaQANSmpQDMs6kA1bmpANm5tAD9qKcA47qhAPixqwDjvLMA/bOzALnIgAD5xYsA6sObAPnF
            lQD31ZkA28WuAOjDqAD3zKYA7dCvAP3TqQDozbYA+Mq5AOrTuAD92bcA/Om3AK66xACR5/4Ase3+AM3N
            zQDV1dUA5svKAP7LxwDt1cEA/NfFAOjY0wD83NQA/uPIAP3zwgDr5N0A/uvXAM/1/gDn5+UA8+zmAP3y
            5wDp+v8A/fv5AAAAAADp+v8A/fv5AAAAAAABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
            MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDABAQEBAQEBAcDGxsbCwsLBwcHBwcHBwcHBwcHBwcHAMAEBAQEB
            AQEB0PXx7+/v7+/v7+/v7+/v7+/v7+/v28AwAQEBMDAwAQHQ9fXy8vLy8vLy5eXl5eXh4eHh4dvlwDAB
            ATBZLTABAdD19fXy8vLy8vLy5eXl5eXh4eHh4eXAMAEwWk4ZLgEB0PX19fXy8vLy8vLy5eXl5eXh4eHh
            5bgwMFJNGSEBAQHR+PX19fXy8vLy8vLy5eXl5eXh4eHOfaZRTRkhAQEBAdH59fX19fXy8vLy8vLy5eXl
            5eXhfXpdUB4eIQEBAQEB0vn59fX19fXy8vLy8vLy5eXl4X1qXVAdGSEBAQEBAQHS+fn59fX19fXy8vLy
            8vLy5d99gF1QHholAQEBAQEBAd35+fn59fX19fXy8vLy8u/bel5UTx4eIQEBAQEBAQEB3fv5+fn59fX1
            9fXy8vLhfdhfVE8ZGVkwAQEBAQEBAQHd+/n5+fn59fX19fXy231JbVdPHh5luDABAQEBAQEBAd37+fn5
            +fn59fX15cp9TM/mbh4e3eXAMAEBAQEBAQEB3fv7+fn5+fn59d/Kec/svktvNN3y5cAwAQEBAQEBAQHi
            +/v7+fn5+e/KyMLszzw6R0jl8vLlwDABAQEBAQEBAeL7+/v7+fXbyj/s0nVtSUg88vLy8uXAMAEBAQEB
            AQEB4vv7+/nl27goKEDBTMZtSPLy8vLy5cAwAQEBAQEBAQHi+/v728aOh4aEJz1Mvkj19fXy8vLlwDAB
            AQEBAQEBAeL7+/vni4uRm4onhCpL9fX19fXy8uXAMAEBAQEBAQEB7vv76KyWlKmrnpOIKfX59fX19fXy
            5cAwAQEBAQEBAQHu+/qxsbGPk6CrqZz4+fn59fX19fXlwDABAQEBAQEBAe776bGxsbGaj5qw+fn5+fn5
            9fX19eXAMAEBAQEBAQEB7/u1sbGxsbGsrvv7+fn5+fnx8e3t5cAwAQEBAQEBAQHv+7OxsbGxsbH7+/v7
            +fn5+e/X18PDwDABAQEBAQEBAe/7tLGxsunp+/v7+/v7+fn5zXFiYWF4MAEBAQEBAQEB8vu2sba2+/v7
            +/v7+/v7+fnafGNjbzABAQEBAQEBAQHy+/a0+/r7+/v7+/v7+/v7+d7ZdHowAQEBAQEBAQEBAfL7+/v7
            +/v7+/v7+/v7+/v54tx6MAEBAQEBAQEBAQEB9fv7+/v7+/v7+/v7+/v7+/nixzABAQEBAQEBAQEBAQHh
            5eXl5eXi4t7e3t7e3tTU0d67AQEBAQEBAQEBAQEB/////8AAAH+AAAB/gAAAcYAAAGGAAABBgAAAA4AA
            AAeAAAAPgAAAH4AAAD+AAAB/gAAAf4AAAH+AAAB/gAAAf4AAAH+AAAB/gAAAf4AAAH+AAAB/gAAAf4AA
            AH+AAAB/gAAAf4AAAH+AAAB/gAAA/4AAAf+AAAP/gAAH/4AAD/8oAAAAEAAAACAAAAABAAgAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzGg0ANRwQACsrAwAyKQ4AMzMAACwsFQA1JxQANDUXACcn
            JwA3JCQAOTUjADMzMwBVAAAARSgZAFUrFQBNMxoAUDAbAEMmIwBVKysASDUlAFc3JwBgMCAAMU8cAAJo
            AwAQaQ0AB3ELABdqEgANehQAE3YWAC1oHQA6VCoAK2wiAExMAABRQy4AZEUpAEdwOAB3YDEABQ1wAAwj
            ewAlKH4ATDp7AEJGQQB+TUwAUHBOAGd5XABRfGAAZmZmAH1wZwCAAAAAv2YZAJBWPQDWcAAA4HoAAIFO
            TgCFUlIAkl9fALRUSwCKYlIAvGJRAIZZdgCYaWgAi2p8AJ1jdQChbmoAvWlmAKd0bQCjbn0ApXlzALB7
            cQDBaE4AwWxWAMl3UwDBbmQAxndjAMN6dgAThB4AGo4oACObNAAnoTsALahFADGsSAAysUsAOrtWAFyO
            RQBhkkcAT7VVAFaJawBvkWwAUKxxAD3CWwA/xmAARcxmAGTVdQBW4HsA9Y8AANmHNQDnlTgA/agxAL+R
            UQCVmnMAv4ttAKyBfAC2g3QAkrRlAKm1cgDakUMAz4hWANKGVQDNllgA15RbAOSVQQDuoUcA96ZDAP+w
            RAD+tVQA041qANqaYwDJh3kAxZJ7ANmbeQDSqnAA5qRtAP+8ZgDnqHQA7bB6APK6egCFzXcAsMJ4AP/A
            dAAKHoUACiWIABQohgAIMIsAETGJAA4skgAKPJcAETeZAC86iwAUPaQAE0KZAD5GigAKRqQAFkisAB9S
            rgAZTLMAF1a5AChWrAADarkAR06VAF9ihQBoZJIAHlzDABRsyAAgY8oAO2vCADR2xwAja9IAJHbaACZ+
            4gCEeIoAqniIAMF+gQAAAAAAYpyDAGeqhwB0i7MAMYPPACiC5wAti/EAMJH3AAq29QAusucATY3VAGmC
            wABIl+4AAMv+ABXQ/wAm0v4AM9X/AFPb/gB34/8AkYeAAKaMhACziIUAtZOLAKqakAC6sIcAtqK0AMaG
            hQDJmYUA2ZiKAMmYkQDQnZUA/J2dANmmhQDKpJQA06aWANiymQDjrYcA57KJAPK5hQDgrJAA/6CfAOu3
            kADwtpAA1KalAMyzqQDVuakA2bm0AP2opwDjuqEA+LGrAOO8swD9s7MAuciAAPnFiwDqw5sA+cWVAPfV
            mQDbxa4A6MOoAPfMpgDt0K8A/dOpAOjNtgD4yrkA6tO4AP3ZtwD86bcArrrEAJHn/gCx7f4Azc3NANXV
            1QDmy8oA/svHAO3VwQD818UA6NjTAPzc1AD+48gA/fPCAOvk3QD+69cAz/X+AOfn5QDz7OYA/fLnAOn6
            /wD9+/kAAAAAAOn6/wD9+/kAAAAAAAEwMDAwMDAwMDAwMDABAQFDxsbGxsXBwcHBurkwMDABaPDy8vLl
            5eXh4ePUMFguAWjw9fLy8uXl5eHjeloeLQF39PX18vLy5eXbelIeLQEBePT19fXy8uXbaVAZJQEBAb/3
            +fX19fLJalAZ4zABAQHE+Pn59eV5wtof3eMwAQEBxPn58snGwkhL7+/jMAEBAcT75aGERExL8vLv4zAB
            AQHE+6eUm4M99fX17+MwAQEBxOixmqmu+Pn19e3jMAEBAcS0sbGt+/n57+/VwTABAQHEsbXp+/v7+3Jy
            cDABAQEBxOj7+/v7+/vEfzABAQEBAcTExMTExMTExDABAQEBAQGAB/n1AAH19QAB8vIAAfLlAAPl5QAH
            el0ABx4hAAcBAQAH+fkAB/X1AAfy8gAH8vIAB+XhAA9dUAAfIQEAPwEBKAAAADAAAABgAAAAAQAgAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzGg0UMxoNFDMaDRQzGg0UMxoNFDMaDRQzGg0UMxoNFDMa
            DRQzGg0UMxoNFDMaDRQzGg0UMxoNFDMaDRQzGg0UMxoNFDMaDRQzGg0UMxoNFDMaDRQzGg0UMRgMFTMa
            DRQzGg0UMxoNFDMaDRQzGg0UMxoNFDMaDRQzGg0UMxoNFDMaDRQ5HA4SNxISDisrAAYAAAACAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzGg1QMxoNUDMaDVAzGg1QMxoNUDMa
            DVAzGg1QMxoNUDMaDVAzGg1QMxoNUDMaDVAzGg1QMxoNUDMaDVAzGg1QMxoNUDMaDVAzGg1QMxoNUDMa
            DVAzGg1QMhwNUTMaDVAzGg1QMxoNUDMaDVAzGg1QMxoNUDMaDVAzGg1QMxoNUDQaDU80HA5JMxwONzMf
            ChkrKwAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzGg2vMxoNrzMa
            Da8zGg2vMxoNrzMaDa8zGg2vMxoNrzMaDa8zGg2vMxoNrzMaDa8zGg2vMxoNrzMaDa8zGg2vMxoNrzMa
            Da8zGg2vMxoNrzMaDbA0HA+yMxoNsDMaDbAzGg2wMxoNrzMaDa8zGg2vMxoNrzMaDa8zGg2vMxoNrzMa
            Da4yGw2iMxoNeDMcDjc3EhIOAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAACAAAAAgAAAAEAAAABAAAAAJJf
            X/+QXV3/j1xc/45bW/+NWlr/jFlZ/4tYWP+JVlb/h1RU/4dUVP+GU1P/hFFR/4NQUP+DUFD/g1BQ/4NQ
            UP+DUFD/g1BQ/4NQUP+DUFD/g1BQ/4NQUP+DUFD/g1BQ/4NQUP+DUFD/g1BQ/4NQUP+DUFD/g1BQ/4NQ
            UP+CT0//gE1N/39MTP+ATU3/MxsNoTQYDko5HA4SAAAAAgAAAAFVVQADSUkkBzckJA45KxwSORwOEjsn
            FA0rKysGAAAAApRhYf/yzMz//8zM///MzP//zMz//8zM///MzP//zMz//8zM///MzP//zMz//8zM///M
            zP//zMz//8zM///MzP//zMz//8zM///MzP//zMz//8zM///MzP//zMz//8zM///MzP//zMz//8zM///M
            zP//zMz//8zM///MzP//zMz//8zM///Mmf+BT0//MxoNrjQaDU8zGg0UAAAAAzMzMwVERDMPOjMkIzgr
            Hjs0IxVJNiASRzQmEzYxJxQaQCAgCJRhYf/MzMz//+nT///o0f//58///+bO///lzP//5Mr//+PI///j
            xv//4sT//+HD///gwf//37///969///cuv//3bz//926///cuP//27b//9q1///Zsv//2LH//9ev///W
            rf//1az//9Sq///TqP//06b//9Kk///Ro///0KH//86n///Ky/+CUFD/MxoNrzMaDVAuFwwWOTkcCUY6
            LhZANic0OjAgYDgmGY01IROkMyAQoDMjE3w0KBRAMTEYFZViYv/Nzc3//+rV///p0///6NH//+fP///m
            zv//5cz//+TK///jyP//48b//+LE///hw///4MH//+DB///fv///3r3//928///duv//3Lj//9u2///a
            tf//2bL//9ix///Xr///1q3//9Ws///Uqv//06j//9Om///SpP//0aP//8+o///Jyf+EU1L/MxoNrzIc
            DFIzIhoeQjopHz42J0JBQC99X5N85FmgfP9NkmX/O1428TMiEK4yJxJhNS0PIpdkZP/Ozs7//+vW///q
            1f//6dP//+jR///nz///5s7//+XM///kyv//48j//+PG///ixP//4sX//+HC///gwf//37///969///d
            vP//3br//9y4///btv//2rX//9my///Ysf//16///9at///VrP//1Kr//9Oo///Tpv//0qT//9Cp///I
            yP+FVFP/NBsNsjUeEVw8Khw3PTMjUEpYRZ1hnYHyLqVF/x2SLP8LdxH/JG0f/zA4FMkyKBJmMisOJJhl
            Zf/Q0ND//+zY///r1v//6tX//+nT///o0f//58///+bO///lzP//5Mr//+PI///jyP//4sb//+LF///h
            wv//4MH//9+////evf//3bz//926///cuP//27b//9q1///Zsv//2LH//9ev///Wrf//1az//9Sq///T
            qP//06b//9Gr///Gx/+HVVT/NBsPvDUiE3k4KhxtU3FdvWOtifwupUX/HZIs/wt3Ef8AZgD/GWkT/zA7
            FbMxJxBOMzMUGZlmZv/R0dH//+za///s2P//69b//+rV///p0///6NH//+fP///mzv//5cz//+XL///k
            yv//48j//+LG///ixf//4cL//+DB///fv///3r3//928///duv//3Lj//9u2///atf//2bL//9ix///X
            r///1q3//9Ws///Uqv//06j//9Gs///Fxf+IV1b/NBwQ0zUhE6xagm3dV7h8/ymjPf8bjyn/C3cR/wBm
            AP8OaAv/LmMg7TEvE2syLBMpLi4XC5xpZ//S0tL//+3c///s2v//7Nj//+vW///q1f//6dP//+jS///o
            0P//58///+bN///ly///5Mr//+PI///ixv//4sX//+HC///gwf//37///969///dvP//3br//9y4///b
            tv//2rX//9my///Ysf//16///9at///VrP//1Kr//9Ku/+6ykf+JWVf/OCYY7WSchflJuGv/Jp85/xiL
            Jf8JdQ//AGYA/w9oDP8uYyDsMS8TajMoES0zMxEPVVUAA55raP/T09P//+7e///t3P//7Nr//+zZ///s
            2P//69b//+rU///p0///6NH//+fP///mzf//5cv//+TK///jyP//4sb//+LF///hwv//4MH//9+////e
            vf//3bz//926///cuP//27b//9q1///Zsv//2LH//9ev///Wrf/+1Kr/7LB7/+albv+LWVj/bLKW/0G4
            YP8mnzn/GIsl/wdxC/8AZgD/EWgN/y5ZHdcwMBRjMiwTKTckEg5AQAAEAAAAAKFuav/V1dX//+/f///u
            3v//7t3//+3b///s2v//7Nj//+vW///q1P//6dP//+jR///nz///5s3//+XL///kyv//48j//+LG///i
            xf//4cL//+DB///fv///3r3//928///duv//3Lj//9u2///atf//2bL//9ix//zRp//pqHL/5qRt/86o
            av9Mz2z/NrdS/yWeOP8YiyX/B3EL/wBmAP8RaQ3/L1ke1TQnD1QwKQ4lKysVDAAAAAMAAAAAAAAAAKNw
            a//W1tb///Dh///w4P//79///+7d///t2///7Nr//+zY///r1v//6tT//+nT///o0f//58///+bN///l
            y///5Mr//+PI///ixv//4sX//+HC///gwf//37///969///dvP//3br//9y4///btv//2rX/98ea/+mo
            cv/mpG3/rbZu/0PMZv80tU//JZ44/xOEHv8HcAr/AGYA/xFqDv8wVB3EMScQTjUtDyIzMxoKAAAAAgAA
            AAAAAAAAAAAAAKVybP/X19f///Hj///x4v//8OH//+/f///u3f//7dv//+za///s2P//69b//+rU///p
            0///6NH//+fP///mzf//5cv//+TK///jyP//4sb//+LF///hwv//4MH//9+////evf//3bz//926//7a
            tv/yvI3/6ahy/+elbv+Fx3L/Q8xm/zS0Tv8jmjT/E4Qe/wdwCv8AZgD/EGoN/zBLGrIxJhFJMSkQHzk5
            HAkAAAACAAAAAAAAAAAAAAAAAAAAAKh1bv/Y2Nj///Ll///y5P//8eP///Dh///v3///7t3//+3b///s
            2v//7Nj//+vW///q1P//6dP//+jR///nz///5s3//+XL///kyv//48j//+LG///ixf//4cL//+DB///f
            v///3r3//Ney/+6zf//pqHL/26xx/2bYeP9DzGb/MbBK/yOaNP8ThB7/A2wG/wBmAP8Qag7/Mk0crDEm
            D0M3LhIcOTkcCQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAKt4b//a2tr///Pm///z5v//8uT///Hj///w
            4f//79///+7d///t2///7Nr//+zY///r1v//6tT//+nT///o0f//58///+bN///ly///5Mr//+PI///i
            xv//4sX//+HC///gwf/50Kn/7K54/+mpcv/MtHT/VuB7/0HIYv8wr0n/IZkz/w9+GP8DbAb/AGYA/yZ0
            Iv0xPBePMyYRPDUrFRgkJCQHAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK57cP/b29v///To///z
            6P//8+b///Lk///x4///8OH//+/f///u3f//7dv//+za///s2P//69b//+rU///p0///6NH//+fP///m
            zf//5cv//+TK///jyP//4sb/+M6n//TAkv/rrXb/6alz/7DCeP9R33n/P8Zg/zCvSf8hmTP/D30X/wNs
            Bv8AZgD/JnQi/jI3FZo1JRA+Oi4XFisrKwYAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALB9
            cf/c3Nz///Xq///06f//8+j///Pm///y5P//8eP///Dh///v3///7t3//+3b///s2v//7Nj//+vW///q
            1P//6dP//+jR///nz///5s3//+XL///kyv/83L3/7rF7/+ytd//mrHT/jdN+/0/dd/8+w13/LqxG/yCX
            Mf8PfRf/A2wG/wBmAP8ecxv/OjEawzUdEGAwIBAgJCQkBwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAALJ/c//d3d3///Xs///17P//9On///Po///z5v//8uT///Hj///w4f//79///+7d///t
            2///7Nr//+zY///r1v//6tT//+nT///o0f//58///+bN//fMpP/vs33/7K13/8p3Wf/Ab1D/YdBy/zzB
            W/8tqkT/HZIs/w58Fv8CaQP/AGYA/1F/Pf+VZmT/MhoNsTQcDFMuFwwWAAAAAwAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAALaDdP/f39////bu///27f//9ez///Tp///z6P//8+b///Lk///x
            4///8OH//+/f///u3f//7dv//+za///s2P//69b//+rU///p0//72bn/8rmG/++xe//rrXf/1Y1t/9aK
            V//cmGD/zZZZ/zGpRP8dkiz/DHgS/wFoAv8AZgD/XI5F//+1tf+XaGX/MxoNrzMaDVAzGg0UAAAAAgAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALiFdf/g4OD///fw///37///9u3///Xs///0
            6f//8+j///Pm///y5P//8eP///Dh///v3///7t3//+3b///s2v//7Nj//ufP//bCk//xtYD/77J8/+Sj
            dv/DeXL/zJSU/+XAr//78sP/8NSe/7+RUf8MeBL/AWgC/wBmAP9jlEn//9LA//+0tP+YaWf/MxoNrzMa
            DVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALuId//h4eH///ny///4
            8f//9+////bt///17P//9On///Po///z5v//8uT///Hj///w4f//79///+7d//7s2f/5z6j/9LqF//G2
            gP/usHv/zoh2/8iLi//cuLj/8N/d/9esrP/fsJD/8NSe/9mPV/93YDH/AGYA/6K0e///37///9DB//+y
            sv+Zamj/MxoNrzMaDVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL6L
            eP/i4uL///r0///58v//+PH///fv///27f//9ez///Tp///z6P//8+b///Lk///x4///8OH//ODD//a/
            i//0uoX/8baA/96efP/FhIL/1amo//Ll5f/evb3/xICA/7JTT/+vSkf/0oVV/8p3Uv+tSUb/urCH///h
            wv//4MH//9DA//+wsf+bbGr/MxoNrzMaDVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAMCNef/k5OT///v2///69P//+fL///jx///37///9u3///Xs///06f//8+j///Pm//7r
            2P/6yJn/9r6J//S6hf/ssIL/y4l+/9Ompv/t2tn/5cvJ/8aHh/+0WVb/vWFM/7teS//BaE7/vWFM/7pg
            Wf/ls6D//+LG///ixf//4cL//9DA//+wr/+cbWv/MxoNrzMaDVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAMOQe//l5eX///v4///79v//+vT///ny///48f//9+////bt///1
            7P//9On//d29//nCjv/3v4r/87mF/9ubgP/Qn5//5cnH/+rT0f/PmZT/yHxk/859VP/OfFL/yHJQ/8Zw
            UP+9YUz/zYR4///ly///5Mr//+PI///ixv//4sX//8/A//+urf+db2z/MxoNrzMaDVAzGg0UAAAAAgAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMWSff/m5ub///z5///7+P//+/b///r0///5
            8v//+PH///fv//7t3P/8ypr/+cKO//e/iv/Fn4b/FCh7/7aitP/q1ND/1KWi/8+Oe//blWH/2pRf/9mQ
            V//ViVX/y3lS/71hTP/NhXn//+fP///mzf//5cv//+TK///jyP//4sb//87A//+srf+fcW3/MxoNrzMa
            DVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMiVfv/n5+f///38///8
            +f//+/j///v2///69P//9/D//ty6//zHk//5w47/8LuK/19ihf8BG3r/EjiQ/xQje//AeHj/x4KC/8qH
            h//JgXn/4rWi/92ie//ThVX/vWFM/82Fev//6dP//+jR///nz///5s3//+XL///kyv//48j//86///+r
            q/+gcm//MxoNrzMaDVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMqX
            f//p6en///79///9/P///Pn///v4///v3//+z5///MiU//nDj/+1l4z/FDCF/wsxiv8MOpH/ARN1/wMK
            cP8bEmr/wX6B/8qHh/+7Zmb/xX19/+O8s/++Y07/zYZ8///r1v//6tT//+nT///o0f//58///+bN///l
            y///5Mr//86///+pqf+hdHD/MxoNrzMaDVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAM2agP/q6ur////+///+/f///fz///z5//7evf/8yJT/9MCP/25ojv8cLoX/HECT/wkx
            iv8PNZr/Dy2U/wcVfP8AAWf/GxJq/7F7if/Gf3//wXR0/8FvZf/Nh33//+za///s2P//69b//+rU///p
            0///6NH//+fP///mzf//5cv//82///+oqP+idXL/MxoNrzMaDVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAANCdgf/r6+v//////////v///v3///38//7y5v/Mq5f/S02T/y02
            iP8qPY3/IEig/yNq0f8hY8r/FD6l/w0pkP8EDXT/Awpx/xAkh/+xfYv/wW5k/82Hfv//7t3//+3b///s
            2v//7Nj//+vW///q1P//6dP//+jR///nz///5s3//82///+np/+jd3P/MxoNrzMaDVAzGg0UAAAAAgAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANOggv/s7Oz///////////////7///79/6Pi
            /f8xg8//RkeR/z9Gkf8uWrH/MJD0/y+N9P8lctn/H17F/xdHrv8OLZP/FD2k/woghv8BA2r/oXWH///w
            4f//79///+7d///t2///7Nr//+zY///r1v//6tT//+nT///o0f//58///8y///+lpf+leXT/MxoNrzMa
            DVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANWihP/u7u7/////////
            ////////zfX+/wbF//8Qu///Ol6n/yBMpf8bZsj/KIDh/y6O9P8ymP7/K4Xs/x1ZwP8fXsT/GUyz/wwl
            jP9eXpv///Lk///x4///8OH//+/f///u3f//7dv//+za///s2P//69b//+rU///p0///6NH//8y+//+k
            pP+menb/MxoNrzMaDVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANil
            hf/v7+//////////////////MdX//wDM//8Byv//Cb77/wRFnf8NSKb/Fly9/yJ12P8si/D/Lovx/y6N
            8/8nd97/HFa9/2mCwP//8+j///Pm///y5P//8eP///Dh///v3///7t3//+3b///s2v//7Nj//+vW///q
            1P//6dP//8u+//+io/+oe3f/MxoNrzMaDVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAANqnhv/w8PD////////////G8///AMz//wDM//8AzP//AMz//wTH//8Fd8P/CT+c/xNV
            tf8hcNT/K4bo/zGW/P8xk/n/R4/m///17P//9On///Po///z5v//8uT///Hj///w4f//79///+7d///t
            2///7Nr//+zY///r1v//6tT//8u///+goP+pfXj/MxoNrzMaDVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAN2qiP/x8fH///////////841///AMz//wDM//8AzP//AMz//wDM
            //8Ay///Ba/u/wVCm/8QTq7/GmTG/yZ83/9KnPL/+fTv///27f//9ez///Tp///z6P//8+b///Lk///x
            4///8OH//+/f///u3f//7dv//+zZ///s1///69b//8q+//+gn/+qf3n/MxoNrzMaDVAzGg0UAAAAAgAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCtiv/z8/P///////f9//8AzP//AMz//wDM
            //8AzP//AMz//wDM//8AzP//AMz//wLE+/8DZLT/C0Si/zZww//49fH///jx///37///9ez///Xq///0
            6P//8+b///Ll///x4///8OH//+/f///u3v//7dz//+za///s2P//69b//8q+//+enf+rgHv/MxoNrzMa
            DVAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOwi//09PT//////9T2
            //8AzP//AMz//wDM//8AzP//AMz//wDM//8AzP//AMz//wDM//8Ay///J7nt//j19P//+vT///ny///4
            8f//9u7///Xs///16v//9Oj///Pm///y5f//8eP///Dh///v3///7t7//+3c///s2v//7Nj//8m+//+c
            nf+sgn3/NBsNrTQaDU8zGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOWy
            jP/19fX//////9T2//8AzP//AMz//wDM//8AzP//AMz//wDM//8AzP//AMz//1ze/v8j0v7/9/v5///7
            +P//+/b///r0///58v//9/D///bu///17P//9er///To///z5v//8uX///Hj//+8vf//uLf//7Oz//+u
            rv//qan//6Sk//+gn/+ug37/Nx4RozgcEUk5HA4SAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAOe0jv/29vb//////9T2//8AzP//AMz//wDM//8AzP//B83//wfN//8q1P//B83///f9
            /v/w+/3///38///8+f//+/j///v2///69P//+PH///fw///27v//9ez///Xq///06P//8+b/upGK/7mP
            iP+2jIb/tYqF/7OIhP+yh4P/sYaB/7BwcP+bamn/OyEVhUAgFzg7JxQNAAAAAQAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAOq3j//4+Pj///////f9//8AzP//AMz//wDM//8V0P//Vd3//3/l
            ////////8Pz///////////7///79///9/P///Pn///v4///79v//+fP///jx///38P//9u7///Xs///1
            6v//9Oj/pXJs//+0Uv//mQD/9Y8A/+uFAP/gegD/1nAA/79mGf9+UU7XQSUZUkQiGh5VKysGAAAAAQAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO26kP/5+fn///////////8V0P//AMz//wDM
            //+q7v//jej//3/l///////////////////////////+///+/f///fz///z5///7+P//+vX///nz///4
            8f//9/D///bu///17P//9er/qHVu///Mmf//tFL//7BE//+rNv//qC3/2Yw5/4BTUNhAIxpXRyMcJE0z
            GgqAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPC9kf/6+vr/////////
            //9V3f//AMz/////////////2/f//831/////////////////////////////////v///v3///38///8
            +f//+/f///r1///58///+PH///fw///27v//9ez/q3hv///Wo///t1v//7RS//+wRP/bk0n/g1ZS2EMm
            GldFKRwlRi4XC4AAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPPA
            kv/7+/v///////////+N6P//MdX/////////////////////////////////////////////////////
            //////7///79///9/P//+/j///v3///69f//+fP///jx///38P//9u7/rntw///grf//u2f//7db/92b
            W/+HWlTYQyYaV0UpHCVGLhcLgAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAPXCk//9/f3/////////////////9/3/////////////////////////////////////
            ///////////////////////////+///+/f///Pr///v4///79///+vX///nz///48f//9/D/sH1x///r
            uP//wHT/3qFq/4pdVthDJhpXRSkcJUYuFwuAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAPfElf/+/v7//v7+//7+/v/+/v7//v7+//39/f/9/f3//f39//39
            /f/8/Pz//Pz8//z8/P/8/Pz/+/v7//v7+//7+/v/+/v7//v7+v///vz///z6///7+P//+/f///r1///5
            8///+PH/sn9z///1wv/gqHv/jmFX2kYpHVhMKRwlRi4XC4AAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPrHl/////////////7+/v/9/f3//Pz8//z8
            /P/7+/v/+vr6//r6+v/5+fn/+Pj4//f39//39/f/9vb2//X19f/19fX/9PT0//Pz8//z8vL/8vHw//Hw
            7//w7uz/8O3r/+/s6f/u6+j/toN0/+zftv+OYlbkRikbaUsyJSlVKxUMgAAAAgAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7Lmf/81rH/+tSw//jR
            rv/1z63/882r//HLqv/uyKn/7MWo/+rDpv/owaX/5b+k/+O9ov/guqH/3ref/9u1nv/as53/17Gb/9Wu
            mv/SrJn/0KqY/86nlv/LpZX/yaOU/8agkv/EnpH/uIV1/7WCdJ8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAA
            AAAD/wAAgAAAAAH/AACAAAAAAYEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAAHAAAAAAAAAA8AAAAA
            AAAAHwAAAAAAAAA/AAAAAAAAAH8AAAAAAAAA/wAAAAAAAAH/AAAAAAAAAf8AAAAAAAAB/wAAAAAAAAH/
            AAAAAAAAAf8AAAAAAAAB/wAAAAAAAAH/AAAAAAAAAf8AAAAAAAAB/wAAAAAAAAH/AAAAAAAAAf8AAAAA
            AAAB/wAAAAAAAAH/AAAAAAAAAf8AAAAAAAAB/wAAAAAAAAH/AAAAAAAAAf8AAAAAAAAB/wAAAAAAAAH/
            AAAAAAAAAf8AAAAAAAAB/wAAAAAAAAH/AAAAAAAAA/8AAAAAAAAH/wAAAAAAAA//AAAAAAAAH/8AAAAA
            AAA//wAAAAAAAH//AAAAAAAP//8AACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAMx8KGTMcDjc0HA5JNBoNTzMaDVAzGg1QMxoNUDMaDVAzGg1QMxoNUDMaDVAzGg1QMxoNUDMa
            DVAzGg1QMxoNUDMaDVAzGg1QMxoNUDMaDVAzGg1QNBoNTzQcDkkzHA43Mx8UGSsrAAYAAAABAAAAAQAA
            AAEAAAABAAAAAAAAAAAzHA43MxoNeDIbDaIzGg2uMxoNrzMaDa8zGg2vMxoNrzMaDa8zGg2vMxoNrzMa
            Da8zGg2vMxoNrzMaDa8zGg2vMxoNrzMaDa8zGg2vMxoNrzMaDa8zGg2uNBsOojUcD3g4HA43MyIRDzMz
            MwU5ORwJOzsnDUYuLgszMzMFAAAAANCei//ZpZn/1qOW/9Whlv/ToJX/06CV/9GelP/QnZT/zpuT/86a
            k//OmpP/zpqT/86ak//NmZL/zZmS/82Zkv/NmZL/zZmS/8yZkv/MmJL/zJiS/8yYkf/bl4z+NBwOojYf
            EUsxJxQaOjouFjk5Jig5NCE2PDYhLzU1IBgAAAAAzbGo//zh1///4ND//9/P///ezf//3cv//9zJ///b
            yP//28b//tfD//7Xw//+18P//tfD//7Xw//+18P//tfD//7Xw//+18P//tfD//7Xw//+18P//8yZ/9uX
            jP82HRCwOSIUWTguHzI5NSZDOi4fajctG4M3LhtwNjIdPQAAAADJsqj/+ezb///p0///58///+bN///k
            yv//48f//+LF///hwv//4MD//968///duv//27f//9q0///Zsv//167//9as///Uqf//06f//9Gk///Q
            of/90r//25eM/zghE7s7KRp1OjAhZkZSP59RgmTnP1w74jUmFKM1LBZcAAAAAMy1qf/57N3//+rV///p
            0///58///+bN///kyv//48f//+LF///hwv//4MD//968///duv//27f//9q0///Zsv//167//9as///U
            qf//06f//9Gk//3Sv//bl4z/OiIV0DspGqhQalXLS6Zp/xiFI/8CZwL/PEcivzMrFFoAAAAAzrer//nt
            4P//69j//+rV///p0///58///+bN///kyv//48f//+LF///hwv//4MD//968///duv//27f//9q0///Z
            sv//167//9as///Uqf//06f//dK//6WKgP48LB7rXolv8zOsTP8UhB7/AGYA/yttIf8xPBWVNCsROwAA
            AADQuKz/+u7i///t2///69j//+rV///p0///58///+bN///kyv//48f//+LF///hwv//4MD//968///d
            uv//27f//9q0///Zsv//167//9as//7TqP/ws5D/6ahy/2OvgP4uqUX/FIQe/wJoAv8qbCH7Mk4erTIr
            E0IxMRQaAAAAANK6rv/68eb//+7e///t2///69j//+rV///p0///58///+bN///kyv//48f//+LF///h
            wv//4MD//968///duv//27f//9q0///Zsv/906n/6614/8ivbv9IymX/KKI8/w98Fv8TcxP/Km0h+zxG
            I5E3KxU8NTUVGCQkJAcAAAAA07yv//ry6P//8OH//+7e///t2///69j//+rV///p0///58///+bN///k
            yv//48f//+LF///hwv//4MD//968///duv//27f/+tCo/+mocv+svHL/QMZg/yiiPP8NeRP/AGYA/y1p
            Ifk3Qh6INCYTNj0xGBUrKysGAAAAAQAAAADWvrD/+vTr///x4///8OH//+7e///t2///69j//+rV///p
            0///58///+bN///kyv//48f//+LF///hwv//4MD//968//fKn//lqnL/gM93/0DGYP8noTv/EHsW/xBr
            Dv82bCryMS0TcTUlEDAtLQ8RMzMABQAAAAEAAAAAAAAAANjAsv/79e3///Ll///x4///8OH//+7e///t
            2///69j//+rV///p0///58///+bN///kyv//48f//+LF//7fwP/zwJH/1rR3/2fZef89wlv/I5s1/xB7
            Fv8Wdxb/L2Eh9DctFYA2JxQ0MDAQEEBAAAQAAAABAAAAAAAAAAAAAAAA2sKz//v38f//9Oj///Ll///x
            4///8OH//+7e///t2///69j//+rV///p0///58///+bN///kyv/50az/7a94/7nIgP9Y433/ObxV/yKZ
            Mv8Gbwn/B2sH/3aSaP06KRa4PCUXWTckGxwzMwAFAAAAAAAAAAAAAAAAAAAAAAAAAADcxLT/+/jz///1
            6///9Oj///Ll///x4///8OH//+7e///t2///69j//+rV///p0//+5s3/9MKV/+2vef/Oflz/z4hW/0+1
            Vf8imTL/FXsY/xR1FP+VmnP/qY2E+jcgEa88IxNRPSQYFQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAN7G
            tv/7+vf///fu///16///9Oj///Ll///x4///8OH//+7e///t2///69j/+9u9//G3gv/mpHX/x4B1/9it
            qv/36rr/zZpe/xt8G/8WdBT/282i//3Sv//bmIz/Nh0QrzYdEFAzGg0UAAAAAgAAAAAAAAAAAAAAAAAA
            AAAAAAAA38e3//z7+P//+PD///fu///16///9Oj///Ll///x4///8OH//u3c//jKoP/xtoD/2JZ7/9Ki
            ov/mzc3/yIuL/8p/ZP/blFv/kFY9/9vQp///4MD//dK//9yYjP80HA+vNh0QUDMaDRQAAAACAAAAAAAA
            AAAAAAAAAAAAAAAAAADiyrn//P39///69P//+PD///fu///16///9Oj///Ll//zewf/3v4v/66+B/9Oc
            lf/mzs7/0Z+f/7xmW/+7Xkv/w2pO/8FsXP/41rz//+LF///hwv/90r//3JiM/zQcD682HRBQMxoNFAAA
            AAIAAAAAAAAAAAAAAAAAAAAAAAAAAOTMuf/8/v7///v2///69P//+PD///fu//7s2v/6ypv/8LqJ/4tq
            fP/ly8v/27Sy/9ONZ//WjFf/0IBU/8ZvUP+/aVz//OHJ///kyv//48f//+LF//3Sv//cmI3/NBwPrzYd
            EFAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA5s27//z//////Pn///v2///27P/+2LH/+sSQ/6aN
            iP8JI33/AyF//51jdf/OkJD/xn11/+CskP/QglT/v2ld//zkz///58///+bN///kyv//48f//dK//9yY
            jf80HA+vNh0QUDMaDRQAAAACAAAAAAAAAAAAAAAAAAAAAAAAAADo0L3//f/////+/P///Pn//sqX/9Ws
            kf8+Roj/ETGK/wcwjf8LI4n/AAJo/4Ncf//DeHj/yoeF/8BrXv/859T//+rV///p0///58///+bN///k
            yv/90r//3JiN/zQcD682HRBQMxoNFAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAOrRvv/9///////+///+
            /P+uusT/Oj2L/y0+jv8fUq7/IWTL/xI4n/8GE3n/CyGI/0w6e//EdGn//Ona///t2///69j//+rV///p
            0///58///+bN//3Sv//cmY3/NBwPrzYdEFAzGg0UAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA7NTA//3/
            ////////nOr+/xG5/P9BU53/Jlq0/yyJ7P8wkff/JGzT/xtSuf8OLZP/JSh+//fq3///8OH//+7e///t
            2///69j//+rV///p0///58///dK//9yZjf80HA+vNh0QUDMaDRQAAAACAAAAAAAAAAAAAAAAAAAAAAAA
            AADu1sL//f///+n6//8Hzf//AMv//wbB/P8HRqD/FVm6/yZ+4v8wkff/KoHn/ztrwv/47ub///Ll///x
            4///8OH//+7e///t2///69j//+rV///p0//90r//3JmN/zQcD682HRBQMxoNFAAAAAIAAAAAAAAAAAAA
            AAAAAAAAAAAAAPDYw//+////qu7//wDM//8AzP//AMz//wHK//8Ffsn/D02s/x9w0v9Ln/X/+fPu///1
            6///9Oj///Ll///x4///8OH//+7e///t2///69j//+rV//3Sv//cmY3/NRwPrjcdEE8zGg0UAAAAAgAA
            AAAAAAAAAAAAAAAAAAAAAAAA8tnF//////9V3f//AMz//wDM//8AzP//AMz//wDM//8Ds+7/V5fR//j1
            8v//+PD///fu///16///9Oj///Ll///x4///39f//9jQ///Qx///zML//dK//9yVif84HhGoOh8RSzYb
            DRMAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAD03Mf//////yrU//8AzP//AMz//wDM//8AzP//B83//w7O
            /v/3+/n///r2///68///+PD///fu///16///9Of///Tm//nazv/3s7P/96ys//ahov/4mpr/2pWH/jwi
            E5A/JhU9RCIRDwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAPbdx///////ONf//wDM//8AzP//FdD//7Hv
            //+/8v/////+///+/P//+/j///r2///58///9/D///bu///16//98uj/5baR/+6hR//nlTj/3os2/9WC
            Nf+/i23yRCcYYUUpHCVAICAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA+ODK//////9/5f//B83//2rh
            //9x4v/////////////////////+///9+////Pj///r2///58///+PD///fu//zy6f/rwJ7//71g//+p
            Mf/8oiL/z5BR8149LHRKKyAwVTMiD1UAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD64sr//////9T2
            //841////////+n6//////////////////////////7+///9+///+/j///r2///58///9/D//PLq/+vH
            qP//zoX//rVU/9afaPNfQC11UDAbMEstHhFAQEAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPzk
            zP/////////////////////////////////////////////////////////////+/f///fn///v3///7
            9f/+8+3/7dCv///Ylv/Sn3b0XkAtdU4vHzFgMCAQQEBABAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAA/ufS///////+/////f////3////8/////P////v////6/v//+v7///n9///4/P//+Pv+//f5
            +//29/j/9fb2//Px7//u0bD/17eT919ALodNMiQ4VTkrEkBAQAQAAAABAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAD+1Kv//dq5//rXtv/51rT/9tSz//TRs//xz7H/78yw/+3Lrv/syq3/6cer/+bE
            qv/kwqj/48Gn/+G/pf/fvKT/3Lqj/9+vj8bap4YUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAAAAgAAAAYAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAA
            AAGAAAADgAAAD4AAAA+AAAAPgAAAD4AAAA+AAAAPgAAAD4AAAA+AAAAPgAAAD4AAAA+AAAAPgAAAD4AA
            AA+AAAAPgAAAH4AAAB+AAAA/gAAAf4AAD/8oAAAAEAAAACAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAA
            AAAAAAAAMxwONzMaDXgyGw2iMxoNrjMaDa8zGg2vMxoNrzMaDa8zGg2vMxoNrzMaDa4zGg6kNB0PhDUk
            FVY7Lh09NTUkK657bv/ZrZ3/1qia/9OmmP/SpJf/zKGZ/8mel//GnJb/xJmV/8GWk/+2kYv/uI6L/zQe
            EMM1JRaZOC4cfzc1Hly1gnL/5tvR///mzP//48f//+DB///du///27f//9ix///VrP//0qX//862/+69
            pf84KBroUXxg60BjPtM2Lxptu4h1/+jf1f//6dL//+bM///jx///4MH//927///bt///2LH//9Ws//7O
            tv/Qq23/W6V2/RV1Gv8wWyHVNC0XT8KPef/q4tv//+zY///p0v//5sz//+PH///gwf//3bv//9u3//jK
            nv/Qq23/NK1I/xB0FP9BaTPeNCkUWDcpFSXIlXz/7Obf///v3v//7Nj//+nS///mzP//48f//t+///PA
            kv+StGX/KKI8/whvCv87WSfmMyAQbjUkEisrKxUMz5yA/+7p5P//8eP//+/e///s2P//6dL//uLG/+yw
            gP+hqmn/KKI8/wltCf/xxbH/MxsNszIaD1czHwoZAAAABNWig//w7On///To///x4//+7tz/+tSw/92c
            e//RnZr/6siZ/z1iHf/bxKr/8si1/zMaDa8yGQ1RMxoNFAAAAALcqYf/8vDu///37//+5s7/57aN/9qp
            n//UnZL/w25U/8VzY//838P//9bH//LJt/8zGg2vMxoNUDMaDRQAAAAC3KmH//Tz8//+2LP/hHiK/wgn
            hP+jbn3/xHlx/8d2YP/85M7//+bM///Yyv/zzLr/NRwPrjcaEE8zGg0UAAAAAtyph////v3/dIuz/yZZ
            sv8gYsn/Ch6F/4xZb//86tr//+zY///p0v//18r/8829/zggEqc6IhRLORwOEgAAAALcqYf/jej//wLJ
            //8PdMn/J4Dl/0SE2//47uX///Hj///v3v//7Nj//87D//TJuv9BJxmRRikdPkk3JA4AAAAB3KmH/zjX
            //8AzP//AMz//zes4//49vP///fv///06P//1cz//9XM//Wzqv/BkYbnRiwdaU40ISdgQCAIAAAAAdyp
            h/8Ozv//Tdv//7jw/////v3///36///69f//+/X/96ZD//emQ//klUH/Ykg4lE41JT5eNigTVVUAAwAA
            AADcqYf/jej//////////////////////////////////9yph//yunr/g2NJyVA3JFxYQCggbUkkBwAA
            AAEAAAAA3KmH/9yph//cqYf/3KmH/9yph//cqYf/3quI/9ajhP/cqYf/4cWliQAAAAAAAAAAAAAAAAAA
            AAAAAAAAAAAAAAAAAAAAAK7/AADm/wAA3v8AANv/AADY/wAA1f8AANP/AADP/wAAzf8AAMr/AADH/wAA
            xf8AAcL/AAHA/wA/vP8=
    </value>
      </data>
    </root>

  • mercredi 25 juillet 2012 00:39
     
      A du code

    This in the designer for MainForm:

    namespace pF.DesignSurfaceExt {
    partial class MainForm {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
    
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose ( bool disposing ) {
            if ( disposing && ( components != null ) ) {
                components.Dispose();
            }
            base.Dispose ( disposing );
        }
    
        #region Windows Form Designer generated code
    
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent() {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager( typeof( MainForm ) );
            this.splitContainer = new System.Windows.Forms.SplitContainer();
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.propertyGrid = new System.Windows.Forms.PropertyGrid();
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.newFormUseSnapLinesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.newFormUseGridandSnapMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.newFormUseGridMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.newFormAlignControlByhandMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItemUnDo = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItemReDo = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
            this.ToolStripMenuItemCut = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItemCopy = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItemPaste = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItemDelete = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
            this.toolStripMenuItemTools = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripMenuItemTabOrder = new System.Windows.Forms.ToolStripMenuItem();
            this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.ToolStripMenuItemAbout = new System.Windows.Forms.ToolStripMenuItem();
            this.pnl4Toolbox = new System.Windows.Forms.Panel();
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.splitContainer.Panel1.SuspendLayout();
            this.splitContainer.Panel2.SuspendLayout();
            this.splitContainer.SuspendLayout();
            this.menuStrip1.SuspendLayout();
            this.pnl4Toolbox.SuspendLayout();
            this.SuspendLayout();
            // 
            // splitContainer
            // 
            this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.splitContainer.Location = new System.Drawing.Point( 170, 32 );
            this.splitContainer.Margin = new System.Windows.Forms.Padding( 4 );
            this.splitContainer.Name = "splitContainer";
            // 
            // splitContainer.Panel1
            // 
            this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Window;
            this.splitContainer.Panel1.Controls.Add( this.tabControl1 );
            // 
            // splitContainer.Panel2
            // 
            this.splitContainer.Panel2.Controls.Add( this.propertyGrid );
            this.splitContainer.Size = new System.Drawing.Size( 719, 483 );
            this.splitContainer.SplitterDistance = 498;
            this.splitContainer.SplitterWidth = 5;
            this.splitContainer.TabIndex = 0;
            // 
            // tabControl1
            // 
            this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tabControl1.Location = new System.Drawing.Point( 0, 0 );
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size( 498, 483 );
            this.tabControl1.TabIndex = 0;
            // 
            // propertyGrid
            // 
            this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
            this.propertyGrid.Location = new System.Drawing.Point( 0, 0 );
            this.propertyGrid.Margin = new System.Windows.Forms.Padding( 4 );
            this.propertyGrid.Name = "propertyGrid";
            this.propertyGrid.Size = new System.Drawing.Size( 216, 483 );
            this.propertyGrid.TabIndex = 0;
            // 
            // menuStrip1
            // 
            this.menuStrip1.Items.AddRange( new System.Windows.Forms.ToolStripItem[] {
                this.newToolStripMenuItem,
                this.editToolStripMenuItem,
                this.toolStripMenuItemTools,
                this.helpToolStripMenuItem} );
            this.menuStrip1.Location = new System.Drawing.Point( 0, 0 );
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Padding = new System.Windows.Forms.Padding( 8, 2, 0, 2 );
            this.menuStrip1.Size = new System.Drawing.Size( 889, 28 );
            this.menuStrip1.TabIndex = 1;
            this.menuStrip1.Text = "menuStrip1";
            // 
            // newToolStripMenuItem
            // 
            this.newToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] {
                this.newFormUseSnapLinesMenuItem,
                this.newFormUseGridandSnapMenuItem,
                this.newFormUseGridMenuItem,
                this.newFormAlignControlByhandMenuItem} );
            this.newToolStripMenuItem.Name = "newToolStripMenuItem";
            this.newToolStripMenuItem.Size = new System.Drawing.Size( 51, 24 );
            this.newToolStripMenuItem.Text = "&New";
            // 
            // newFormUseSnapLinesMenuItem
            // 
            this.newFormUseSnapLinesMenuItem.Name = "newFormUseSnapLinesMenuItem";
            this.newFormUseSnapLinesMenuItem.Size = new System.Drawing.Size( 318, 24 );
            this.newFormUseSnapLinesMenuItem.Text = "Form (use &SnapLines)";
            this.newFormUseSnapLinesMenuItem.Click += new System.EventHandler( this.newFormUseSnapLinesMenuItem_Click );
            // 
            // newFormUseGridandSnapMenuItem
            // 
            this.newFormUseGridandSnapMenuItem.Name = "newFormUseGridandSnapMenuItem";
            this.newFormUseGridandSnapMenuItem.Size = new System.Drawing.Size( 318, 24 );
            this.newFormUseGridandSnapMenuItem.Text = "Form (use &Grid and snap to the grid)";
            this.newFormUseGridandSnapMenuItem.Click += new System.EventHandler( this.newFormUseGridandSnapMenuItem_Click );
            // 
            // newFormUseGridMenuItem
            // 
            this.newFormUseGridMenuItem.Name = "newFormUseGridMenuItem";
            this.newFormUseGridMenuItem.Size = new System.Drawing.Size( 318, 24 );
            this.newFormUseGridMenuItem.Text = "Form (use Gri&d)";
            this.newFormUseGridMenuItem.Click += new System.EventHandler( this.newFormUseGridMenuItem_Click );
            // 
            // newFormAlignControlByhandMenuItem
            // 
            this.newFormAlignControlByhandMenuItem.Name = "newFormAlignControlByhandMenuItem";
            this.newFormAlignControlByhandMenuItem.Size = new System.Drawing.Size( 318, 24 );
            this.newFormAlignControlByhandMenuItem.Text = "Form (Align control by &hand)";
            this.newFormAlignControlByhandMenuItem.Click += new System.EventHandler( this.newFormAlignControlByhandMenuItem_Click );
            // 
            // editToolStripMenuItem
            // 
            this.editToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] {
                this.ToolStripMenuItemUnDo,
                this.ToolStripMenuItemReDo,
                this.toolStripSeparator3,
                this.ToolStripMenuItemCut,
                this.ToolStripMenuItemCopy,
                this.ToolStripMenuItemPaste,
                this.ToolStripMenuItemDelete,
                this.toolStripSeparator4} );
            this.editToolStripMenuItem.Name = "editToolStripMenuItem";
            this.editToolStripMenuItem.Size = new System.Drawing.Size( 47, 24 );
            this.editToolStripMenuItem.Text = "&Edit";
            // 
            // ToolStripMenuItemUnDo
            // 
            this.ToolStripMenuItemUnDo.Name = "ToolStripMenuItemUnDo";
            this.ToolStripMenuItemUnDo.ShortcutKeys = ((System.Windows.Forms.Keys) ((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
            this.ToolStripMenuItemUnDo.Size = new System.Drawing.Size( 165, 24 );
            this.ToolStripMenuItemUnDo.Text = "Undo";
            this.ToolStripMenuItemUnDo.Click += new System.EventHandler( this.undoToolStripMenuItem_Click );
            // 
            // ToolStripMenuItemReDo
            // 
            this.ToolStripMenuItemReDo.Name = "ToolStripMenuItemReDo";
            this.ToolStripMenuItemReDo.ShortcutKeys = ((System.Windows.Forms.Keys) ((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
            this.ToolStripMenuItemReDo.Size = new System.Drawing.Size( 165, 24 );
            this.ToolStripMenuItemReDo.Text = "Redo";
            this.ToolStripMenuItemReDo.Click += new System.EventHandler( this.redoToolStripMenuItem_Click );
            // 
            // toolStripSeparator3
            // 
            this.toolStripSeparator3.Name = "toolStripSeparator3";
            this.toolStripSeparator3.Size = new System.Drawing.Size( 162, 6 );
            // 
            // ToolStripMenuItemCut
            // 
            this.ToolStripMenuItemCut.Image = ((System.Drawing.Image) (resources.GetObject( "ToolStripMenuItemCut.Image" )));
            this.ToolStripMenuItemCut.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.ToolStripMenuItemCut.Name = "ToolStripMenuItemCut";
            this.ToolStripMenuItemCut.ShortcutKeys = ((System.Windows.Forms.Keys) ((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
            this.ToolStripMenuItemCut.Size = new System.Drawing.Size( 165, 24 );
            this.ToolStripMenuItemCut.Text = "Cut";
            this.ToolStripMenuItemCut.Click += new System.EventHandler( this.OnMenuClick );
            // 
            // ToolStripMenuItemCopy
            // 
            this.ToolStripMenuItemCopy.Image = ((System.Drawing.Image) (resources.GetObject( "ToolStripMenuItemCopy.Image" )));
            this.ToolStripMenuItemCopy.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.ToolStripMenuItemCopy.Name = "ToolStripMenuItemCopy";
            this.ToolStripMenuItemCopy.ShortcutKeys = ((System.Windows.Forms.Keys) ((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
            this.ToolStripMenuItemCopy.Size = new System.Drawing.Size( 165, 24 );
            this.ToolStripMenuItemCopy.Text = "Copy";
            this.ToolStripMenuItemCopy.Click += new System.EventHandler( this.OnMenuClick );
            // 
            // ToolStripMenuItemPaste
            // 
            this.ToolStripMenuItemPaste.Image = ((System.Drawing.Image) (resources.GetObject( "ToolStripMenuItemPaste.Image" )));
            this.ToolStripMenuItemPaste.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.ToolStripMenuItemPaste.Name = "ToolStripMenuItemPaste";
            this.ToolStripMenuItemPaste.ShortcutKeys = ((System.Windows.Forms.Keys) ((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
            this.ToolStripMenuItemPaste.Size = new System.Drawing.Size( 165, 24 );
            this.ToolStripMenuItemPaste.Text = "Paste";
            this.ToolStripMenuItemPaste.Click += new System.EventHandler( this.OnMenuClick );
            // 
            // ToolStripMenuItemDelete
            // 
            this.ToolStripMenuItemDelete.Name = "ToolStripMenuItemDelete";
            this.ToolStripMenuItemDelete.ShortcutKeys = System.Windows.Forms.Keys.Delete;
            this.ToolStripMenuItemDelete.Size = new System.Drawing.Size( 165, 24 );
            this.ToolStripMenuItemDelete.Text = "Delete";
            this.ToolStripMenuItemDelete.Click += new System.EventHandler( this.OnMenuClick );
            // 
            // toolStripSeparator4
            // 
            this.toolStripSeparator4.Name = "toolStripSeparator4";
            this.toolStripSeparator4.Size = new System.Drawing.Size( 162, 6 );
            // 
            // toolStripMenuItemTools
            // 
            this.toolStripMenuItemTools.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] {
                this.toolStripMenuItemTabOrder} );
            this.toolStripMenuItemTools.Name = "toolStripMenuItemTools";
            this.toolStripMenuItemTools.Size = new System.Drawing.Size( 57, 24 );
            this.toolStripMenuItemTools.Text = "&Tools";
            // 
            // toolStripMenuItemTabOrder
            // 
            this.toolStripMenuItemTabOrder.Name = "toolStripMenuItemTabOrder";
            this.toolStripMenuItemTabOrder.Size = new System.Drawing.Size( 145, 24 );
            this.toolStripMenuItemTabOrder.Text = "Tab Order";
            this.toolStripMenuItemTabOrder.Click += new System.EventHandler( this.toolStripMenuItemTabOrder_Click );
            // 
            // helpToolStripMenuItem
            // 
            this.helpToolStripMenuItem.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] {
                this.ToolStripMenuItemAbout} );
            this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
            this.helpToolStripMenuItem.Size = new System.Drawing.Size( 53, 24 );
            this.helpToolStripMenuItem.Text = "&Help";
            // 
            // ToolStripMenuItemAbout
            // 
            this.ToolStripMenuItemAbout.Name = "ToolStripMenuItemAbout";
            this.ToolStripMenuItemAbout.Size = new System.Drawing.Size( 152, 24 );
            this.ToolStripMenuItemAbout.Text = "About...";
            this.ToolStripMenuItemAbout.Click += new System.EventHandler( this.OnAbout );
            // 
            // pnl4Toolbox
            // 
            this.pnl4Toolbox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.pnl4Toolbox.Controls.Add( this.listBox1 );
            this.pnl4Toolbox.Dock = System.Windows.Forms.DockStyle.Left;
            this.pnl4Toolbox.Location = new System.Drawing.Point( 0, 28 );
            this.pnl4Toolbox.Name = "pnl4Toolbox";
            this.pnl4Toolbox.Size = new System.Drawing.Size( 163, 487 );
            this.pnl4Toolbox.TabIndex = 2;
            // 
            // listBox1
            // 
            this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.listBox1.FormattingEnabled = true;
            this.listBox1.ItemHeight = 16;
            this.listBox1.Location = new System.Drawing.Point( 0, 0 );
            this.listBox1.Name = "listBox1";
            this.listBox1.Size = new System.Drawing.Size( 159, 468 );
            this.listBox1.TabIndex = 0;
            // 
            // MainForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF( 8F, 16F );
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size( 889, 515 );
            this.Controls.Add( this.pnl4Toolbox );
            this.Controls.Add( this.splitContainer );
            this.Controls.Add( this.menuStrip1 );
            this.Icon = ((System.Drawing.Icon) (resources.GetObject( "$this.Icon" )));
            this.MainMenuStrip = this.menuStrip1;
            this.Margin = new System.Windows.Forms.Padding( 4 );
            this.Name = "MainForm";
            this.Text = "Tiny Form IDE";
            this.Load += new System.EventHandler( this.MainForm_Load );
            this.splitContainer.Panel1.ResumeLayout( false );
            this.splitContainer.Panel2.ResumeLayout( false );
            this.splitContainer.ResumeLayout( false );
            this.menuStrip1.ResumeLayout( false );
            this.menuStrip1.PerformLayout();
            this.pnl4Toolbox.ResumeLayout( false );
            this.ResumeLayout( false );
            this.PerformLayout();
    
        }
    
        #endregion
    
        private System.Windows.Forms.SplitContainer splitContainer;
        private System.Windows.Forms.PropertyGrid propertyGrid;
        private System.Windows.Forms.MenuStrip menuStrip1;
        private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemUnDo;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemReDo;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemCut;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemCopy;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemPaste;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemDelete;
        private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemAbout;
        private System.Windows.Forms.TabControl tabControl1;
        private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemTools;
        private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemTabOrder;
        private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem newFormUseSnapLinesMenuItem;
        private System.Windows.Forms.ToolStripMenuItem newFormUseGridandSnapMenuItem;
        private System.Windows.Forms.ToolStripMenuItem newFormUseGridMenuItem;
        private System.Windows.Forms.ToolStripMenuItem newFormAlignControlByhandMenuItem;
        private System.Windows.Forms.Panel pnl4Toolbox;
        private System.Windows.Forms.ListBox listBox1;
    
    }
    }
    
    

  • mercredi 25 juillet 2012 00:44
     
      A du code

    This is the main form code:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.ComponentModel.Design;
    using System.ComponentModel.Design.Serialization;
    
    
    using System.Drawing.Design;
    
    namespace pF.DesignSurfaceExt {
    
    public partial class MainForm : Form {
    
    
        private string _version = string.Empty;
        public string Version {
            get {
                if( string.IsNullOrEmpty( _version ) ) {
                    //- Get the actual version of the file hosted in running assembly
                    System.Diagnostics.FileVersionInfo FVI = System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly.GetExecutingAssembly().Location );
                    _version = FVI.ProductVersion;
                }
                return _version;
            }
        }
    
        private List<IDesignSurfaceExt2> _listOfDesignSurface = new List<IDesignSurfaceExt2>();
    
        private IDesignSurfaceExt2 GetCurrentIDesignSurface() {
            if( null  == this._listOfDesignSurface ) return null;
            if( 0 == this._listOfDesignSurface.Count ) return null;
    
            return _listOfDesignSurface[this.tabControl1.SelectedIndex];
        }
    
    
        #region Init
    
        //- ctor
        public MainForm() {
            InitializeComponent();
    
            //- Add the toolboxItems to the future toolbox 
            //- the pointer
            ToolboxItem toolPointer = new System.Drawing.Design.ToolboxItem();
            toolPointer.DisplayName = "<Pointer>";
            toolPointer.Bitmap = new System.Drawing.Bitmap( 16, 16 );
            listBox1.Items.Add( toolPointer );
            //- the control
            listBox1.Items.Add( new ToolboxItem( typeof( Button ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( ListView ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( TreeView ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( TextBox ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( Label ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( TabControl ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( OpenFileDialog ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( CheckBox ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( ComboBox ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( GroupBox ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( ImageList ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( Panel ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( ProgressBar ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( ToolBar ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( ToolTip ) ) );
            listBox1.Items.Add( new ToolboxItem( typeof( StatusBar ) ) );
        }
    
        private void MainForm_Load( object sender, EventArgs e ) {
            this.tabControl1.Selected += new System.Windows.Forms.TabControlEventHandler( this.OnTabPageSelected );
        }
    
        private void OnTabPageSelected( object sender, TabControlEventArgs e ) {
            //- select into the propertygrid the current Form 
            SelectRootComponent();
        } 
    
        #endregion
    
    
    
        //- When the selection changes this sets the PropertyGrid's selected component
        private void OnSelectionChanged ( object sender, System.EventArgs e ) {
            IDesignSurfaceExt isurf = GetCurrentIDesignSurface();
            if ( null != isurf ) {
                ISelectionService selectionService = null;
                selectionService = isurf.GetIDesignerHost().GetService ( typeof ( ISelectionService ) ) as ISelectionService;
                this.propertyGrid.SelectedObject = selectionService.PrimarySelection;
            }
        }
        
        private void SelectRootComponent() {
            //- find out the DesignSurfaceExt control hosted by the TabPage
            IDesignSurfaceExt isurf = GetCurrentIDesignSurface();
            if( null != isurf )
                this.propertyGrid.SelectedObject = isurf.GetIDesignerHost().RootComponent;
        }
    
        private void undoToolStripMenuItem_Click ( object sender, EventArgs e ) {
            IDesignSurfaceExt isurf = GetCurrentIDesignSurface(); 
            if( null != isurf )
                isurf.GetUndoEngineExt().Undo();
        }
    
        private void redoToolStripMenuItem_Click ( object sender, EventArgs e ) {
            IDesignSurfaceExt isurf = GetCurrentIDesignSurface();
            if( null != isurf )
                isurf.GetUndoEngineExt().Redo();
        }
    
        private void OnAbout ( object sender, EventArgs e ) {
            MessageBox.Show( "Tiny Form IDE coded by Paolo Foti \r\nVersion is: " + Version, "Tiny Form IDE", MessageBoxButtons.OK, MessageBoxIcon.Question );
        }
        
        private void toolStripMenuItemTabOrder_Click ( object sender, EventArgs e ) {
            IDesignSurfaceExt isurf = GetCurrentIDesignSurface();
            if( null != isurf )
                isurf.SwitchTabOrder();
        }
    
        private void OnMenuClick( object sender, EventArgs e ) {
            IDesignSurfaceExt isurf = GetCurrentIDesignSurface();
            if( null != isurf )
                isurf.DoAction( (sender as ToolStripMenuItem).Text );
        }
    
        private void newFormUseSnapLinesMenuItem_Click( object sender, EventArgs e ) {
            TabPage tp =new TabPage("Use SnapLines");
            this.tabControl1.TabPages.Add(tp);
            int iTabPageSelectedIndex = this.tabControl1.SelectedIndex;
            //- steps.1.2.3
            DesignSurfaceExt2 surface = CreateDesignSurface();
            //- step.4
            //- choose an alignment mode...
            ((DesignSurfaceExt2)surface).UseSnapLines();
            //- step.5
            //- create the Root compoment, in these cases a Form
            try {
                Form rootComponent = null;
                rootComponent = (Form) surface.CreateRootComponent( typeof( Form ), new Size( 400, 400 ) );
                rootComponent.Text = "Root Component hosted by the DesignSurface N." + iTabPageSelectedIndex;
                rootComponent.BackColor = Color.Yellow;
                //-
                //-
                //- step.4
                //- display the DesignSurface
                Control view = surface.GetView();
                if( null == view ) 
                    return ;
                //- change some properties
                view.Text = "Test Form N. " + iTabPageSelectedIndex;
                view.Dock = DockStyle.Fill;
                //- Note these assignments
                view.Parent = tp;
                //- finally enable the Drag&Drop on RootComponent
                ((DesignSurfaceExt2) surface).EnableDragandDrop();
            }//end_try
            catch( Exception ex) {
                Console.WriteLine( Name + " the DesignSurface N. " + iTabPageSelectedIndex + " has generated errors during loading!Exception: " + ex.Message );
                return ;
            }//end_catch
        }
    
        private void newFormUseGridandSnapMenuItem_Click( object sender, EventArgs e ) {
            TabPage tp = new TabPage( "Use Grid (Snap to the grid)" );
            this.tabControl1.TabPages.Add( tp );
            int iTabPageSelectedIndex = this.tabControl1.SelectedIndex;
            //- steps.1.2.3
            DesignSurfaceExt2 surface = CreateDesignSurface();
            //- step.4
            //- choose an alignment mode...
            ((DesignSurfaceExt2) surface).UseGrid( new System.Drawing.Size( 32, 32 ) );
            //- step.5
            //- create the Root compoment, in these cases a Form
            try {
                Form rootComponent = null;
                rootComponent = (Form) surface.CreateRootComponent( typeof( Form ), new Size( 400, 400 ) );
                rootComponent.Text = "Root Component hosted by the DesignSurface N." + iTabPageSelectedIndex;
                rootComponent.BackColor = Color.YellowGreen;
                //-
                //-
                //- step.4
                //- display the DesignSurface
                Control view = surface.GetView();
                if( null == view ) 
                    return;
                //- change some properties
                view.Text = "Test Form N. " + iTabPageSelectedIndex;
                view.Dock = DockStyle.Fill;
                //- Note these assignments
                view.Parent = tp;
            }//end_try
            catch( Exception ex ) {
                Console.WriteLine( Name + " the DesignSurface N. " + iTabPageSelectedIndex + " has generated errors during loading!Exception: " + ex.Message );
                return;
            }//end_catch
        }
    
        private void newFormUseGridMenuItem_Click( object sender, EventArgs e ) {
            TabPage tp = new TabPage( "Use Grid" );
            this.tabControl1.TabPages.Add( tp );
            int iTabPageSelectedIndex = this.tabControl1.SelectedIndex;
            //- steps.1.2.3
            DesignSurfaceExt2 surface = CreateDesignSurface();
            //- step.4
            //- choose an alignment mode...
            ((DesignSurfaceExt2) surface).UseGridWithoutSnapping( new System.Drawing.Size( 16, 16 ) );
            //- step.5
            //- create the Root compoment, in these cases a Form
            try {
                Form rootComponent = null;
                rootComponent = (Form) surface.CreateRootComponent( typeof( Form ), new Size( 600, 400 ) );
                rootComponent.Text = "Root Component hosted by the DesignSurface N." + iTabPageSelectedIndex;
                rootComponent.BackColor = Color.LightGreen;
                //-
                //-
                //- step.4
                //- display the DesignSurface
                Control view = surface.GetView();
                if( null == view ) 
                    return;
                //- change some properties
                view.Text = "Test Form N. " + iTabPageSelectedIndex;
                view.Dock = DockStyle.Fill;
                //- Note these assignments
                view.Parent = tp;
            }//end_try
            catch( Exception ex ) {
                Console.WriteLine( Name + " the DesignSurface N. " + iTabPageSelectedIndex + " has generated errors during loading!Exception: " + ex.Message );
                return;
            }//end_catch
        }
    
        private void newFormAlignControlByhandMenuItem_Click( object sender, EventArgs e ) {
            TabPage tp = new TabPage( "Align control by hand" );
            this.tabControl1.TabPages.Add( tp );
            int iTabPageSelectedIndex = this.tabControl1.SelectedIndex;
            //- steps.1.2.3
            DesignSurfaceExt2 surface = CreateDesignSurface();
            //- step.4
            //- choose an alignment mode...
            ((DesignSurfaceExt2) surface).UseNoGuides();
            //- step.5
            //- create the Root compoment, in these cases a Form
            try {
                Form rootComponent = null;
                rootComponent = (Form) surface.CreateRootComponent( typeof( Form ), new Size( 400, 400 ) );
                rootComponent.Text = "Root Component hosted by the DesignSurface N." + iTabPageSelectedIndex;
                rootComponent.BackColor = Color.LightGray;
                //-
                //-
                //- step.4
                //- display the DesignSurface
                Control view = surface.GetView();
                if( null == view ) 
                    return;
                //- change some properties
                view.Text = "Test Form N. " + iTabPageSelectedIndex;
                view.Dock = DockStyle.Fill;
                //- Note these assignments
                view.Parent = tp;
            }//end_try
            catch( Exception ex ) {
                Console.WriteLine( Name + " the DesignSurface N. " + iTabPageSelectedIndex + " has generated errors during loading!Exception: " + ex.Message );
                return;
            }//end_catch
        }
        
        private DesignSurfaceExt2 CreateDesignSurface() {
            //- step.0
            //- create a DesignSurface and put it inside a Form in DesignTime
            DesignSurfaceExt2 surface = new DesignSurfaceExt2();
            //-
            //-
            IDesignSurfaceExt2 isurf = (IDesignSurfaceExt2) surface;
            this._listOfDesignSurface.Add( isurf );
            //- step.1
            //- enable the UndoEngines
            isurf.GetUndoEngineExt().Enabled = true;
            //- step.2
            //- try to get a ptr to ISelectionService interface
            //- if we obtain it then hook the SelectionChanged event
            ISelectionService selectionService = (ISelectionService) (isurf.GetIDesignerHost().GetService( typeof( ISelectionService ) ));
            if( null != selectionService )
                selectionService.SelectionChanged += new System.EventHandler( OnSelectionChanged );
            //- step.3
            //- Select the service IToolboxService
            //- and hook it to our ListBox
            ToolboxServiceImp tbox = isurf.GetIToolboxService() as ToolboxServiceImp;
            if( null != tbox )
                tbox.Toolbox = listBox1;
            //-
            //- finally return the Designsurface
            return surface;
        }
    
    }
    
    
    }

    This is all folks.

    Regards