The Labs \ Source Viewer \ SSCLI \ System.ComponentModel.Design \ IComponentInitializer

  1. //------------------------------------------------------------------------------
  2. // <copyright file="IComponentInitializer.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. /*
  16. */
  17. namespace System.ComponentModel.Design
  18. {
  19.    
  20.     using System;
  21.     using System.Collections;
  22.    
  23.     /// <devdoc>
  24.     /// IComponentInitializer can be implemented on an object that also implements IDesigner.
  25.     /// This interface allows a newly created component to be given some stock default values,
  26.     /// such as a caption, default size, or other values. Recommended default values for
  27.     /// the component's properties are passed in as a dictionary.
  28.     /// </devdoc>
  29.     public interface IComponentInitializer
  30.     {
  31.        
  32.         /// <devdoc>
  33.         /// This method is called when an existing component is being re-initialized. This may occur after
  34.         /// dragging a component to another container, for example. The defaultValues
  35.         /// property contains a name/value dictionary of default values that should be applied
  36.         /// to properties. This dictionary may be null if no default values are specified.
  37.         /// You may use the defaultValues dictionary to apply recommended defaults to proeprties
  38.         /// but you should not modify component properties beyond what is stored in the
  39.         /// dictionary, because this is an existing component that may already have properties
  40.         /// set on it.
  41.         /// </devdoc>
  42.         void InitializeExistingComponent(IDictionary defaultValues);
  43.        
  44.         /// <devdoc>
  45.         /// This method is called when a component is first initialized, typically after being first added
  46.         /// to a design surface. The defaultValues property contains a name/value dictionary of default
  47.         /// values that should be applied to properties. This dictionary may be null if no default values
  48.         /// are specified. You may perform any initialization of this component that you like, and you
  49.         /// may even ignore the defaultValues dictionary altogether if you wish.
  50.         /// </devdoc>
  51.         void InitializeNewComponent(IDictionary defaultValues);
  52.     }
  53. }

Developer Fusion