示例#1
0
        /// <summary>
        /// Applies a description onto an object.
        /// </summary>
        /// <param name="obj">The object to apply the description to.</param>
        /// <param name="descriptionIdentifier">The identifier of the description to apply.</param>
        public void ApplyAppearanceOnObject(object obj, string descriptionIdentifier)
        {
            var description = _appearanceMap.GetDescriptionById(descriptionIdentifier);

            if (description != null)
            {
                SetPropertyValue(obj, "ForeColor", description.ForeColor);
                SetPropertyValue(obj, "BackColor", description.BackColor);
                SetPropertyValue(obj, "Font", new Font(GetPropertyValue <Font>(obj, "Font"), description.FontStyle));
            }
        }
示例#2
0
        public void CopyTo(AppearanceMap destination)
        {
            for (int i = 0; i < Descriptions.Count; i++)
            {
                var source = Descriptions[i];
                var target = destination.GetDescriptionById(source.ID);

                if (target == null)
                {
                    target = new AppearanceDescription();
                    destination.Descriptions.Add(target);
                }

                source.CopyTo(target);
            }
        }
 public void CopyTo(AppearanceMap destination)
 {            
     for (int i = 0; i < Descriptions.Count; i++)
     {
         var source = Descriptions[i];
         var target = destination.GetDescriptionById(source.ID);
         
         if (target == null)
         {
             target = new AppearanceDescription();
             destination.Descriptions.Add(target);
         }
         
         source.CopyTo(target);
     }
 }