/// <summary> /// 文字列からWorldExPostionオブジェクトに変換する /// </summary> /// <param name="context"></param> /// <param name="culture"></param> /// <param name="value"></param> /// <returns></returns> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string str = (string)value; WorldExPotision pos = new WorldExPotision(); if (str.IndexOf("@") != -1) { pos.IsRelative = true; str = str.Replace("@", ""); //消去する } if (str.IndexOf("%") != -1) { pos.IsPercent = true; str = str.Replace("%", ""); //消去する } int splitPos = str.IndexOf(":"); if (splitPos != -1) { string[] posStr = str.Split(new char[] { ':' }, 2); pos.ToPos = posStr[0]; pos.FromPos = posStr[1]; } else { pos.ToPos = str; } return(pos); } return(base.ConvertFrom(context, culture, value)); }
/// <summary> /// 属性値を全て初期化する /// </summary> public virtual void ResetAttr() { //リストの初期化 m_type = ""; m_opacity = new WorldExPotision(); m_rotate = new WorldExPotision(); m_zoom = new WorldExPotision(); m_afx = new WorldExPotision(); m_afy = new WorldExPotision(); m_reset = ""; m_xpos = new WorldExPotision(); m_ypos = new WorldExPotision(); m_time = ""; m_accel = ""; m_action = ""; m_trans = ""; m_stopaction = ""; m_stoptrans = ""; m_sync = ""; m_nosync = ""; m_nowait = ""; m_fade = ""; m_visible = ""; m_show = ""; m_hide = ""; m_grayscale = ""; m_rgamma = ""; m_ggamma = ""; m_bgamma = ""; m_resetcolor = ""; }
/// <summary> /// WorldExPotisionオブジェクトを文字列型に変換する /// </summary> /// <param name="context"></param> /// <param name="culture"></param> /// <param name="value"></param> /// <param name="destinationType"></param> /// <returns></returns> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string) && value is WorldExPotision) { WorldExPotision pos = (WorldExPotision)value; return(pos.ToString()); } return(base.ConvertTo(context, culture, value, destinationType)); }