/// <summary> /// 构造函数定义 /// </summary> /// <param Name="gif">传入一个动态图对象</param> public SVGifWindow(SVGif gif) { _gif = gif; ///初始化界面 InitializeComponent(); init(); }
/// <summary> /// 重载EditValue,编辑动态图控件的弹出窗口 /// </summary> /// <param Name="context"></param> /// <param Name="provider"></param> /// <param Name="value"></param> /// <returns></returns> public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { //从当前对象中获取动态图控件对象 SVGif gitInstance = context.Instance as SVGif; if (gitInstance == null) { return(null); } IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { SVGifWindow win = new SVGifWindow(gitInstance); edSvc.ShowDialog(win); gitInstance.RedoUndo.operChanged(); if (gitInstance.Attrib.VarName.Count == 0) { return("未设置变量"); } else { String str = String.Join(",", gitInstance.Attrib.VarName); return(str); } } return(value); }
//建立一个副本 override public object cloneObject() { MemoryStream stream = new MemoryStream(); BinaryFormatter binFormat = new BinaryFormatter(); binFormat.Serialize(stream, this); stream.Position = 0; SVGif result = (SVGif)binFormat.Deserialize(stream); result.refreshPropertyToPanel(); return(result); }