Example #1
0
        /// <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)
        {
            SVHeartbeat heart = context.Instance as SVHeartbeat;

            if (heart == null)
            {
                return(value);
            }

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl picDialog = new SVWpfControl();
                picDialog.Width  = 300;
                picDialog.Height = 300;

                SVWPFHeartPic heartPicture = new SVWPFHeartPic();
                heartPicture.resultListView.ItemsSource = heart.Attrib.BitMapArray.BitmapArray;
                picDialog.addContent(heartPicture);
                edSvc.DropDownControl(picDialog);
                heart.refreshPropertyToPanel();
                heart.RedoUndo.operChanged();

                return(value);
            }

            return(value);
        }
Example #2
0
        /// <summary>
        /// 通过序列化的机制来克隆一个当前对象并返回
        /// </summary>
        /// <returns>一个新的按钮对象</returns>
        override public object cloneObject()
        {
            MemoryStream    stream    = new MemoryStream();
            BinaryFormatter binFormat = new BinaryFormatter();

            binFormat.Serialize(stream, this);
            stream.Position = 0;
            SVHeartbeat result = (SVHeartbeat)binFormat.Deserialize(stream);

            result.refreshPropertyToPanel();

            return(result);
        }