public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { PropertyDescriptorCollection collection = new PropertyDescriptorCollection(null); Decor = (VO_StageDecor)value; collection = Decor.GetProperties(); return(collection); }
public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues) { VO_StageDecor decor = Decor; if (propertyValues["Title"] != null) { decor.Title = propertyValues["Title"].ToString(); } if (propertyValues["Location"] != null) { decor.Location = (Point)propertyValues["Location"]; } return(decor); }
public static void CreateDecor(VO_Layer layer, Point position, string file) { if (layer.ListDecors.Count < GlobalConstants.PERF_MAX_DECORS_PER_LAYERS) { //Récupérer la taille de l'image Size picSize = ImageManager.GetImageStageDecor(GameCore.Instance.Game.Project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + file).Size; VO_StageDecor newDecor = new VO_StageDecor(); newDecor.Id = Guid.NewGuid(); newDecor.Title = Path.GetFileNameWithoutExtension(file); newDecor.Location = position; newDecor.Size = picSize; newDecor.Filename = file; newDecor.ObjectType = Enums.StageObjectType.Decors; newDecor.Stage = layer.Stage; newDecor.Layer = layer.Id; layer.ListDecors.Add(newDecor); } else { MessageBox.Show(string.Format(Errors.STAGE_MAX_DECORS, GlobalConstants.PERF_MAX_DECORS_PER_LAYERS), Errors.ERROR_BOX_TITLE); } }