コード例 #1
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            SVButton svPanel = context.Instance as SVButton;

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

            ///获取当前页面中的所以趋势图
            List <SVCurveProperties> attribList = new List <SVCurveProperties>();

            foreach (var sv in svPanel.Parent.Controls)
            {
                SVCurve curve = sv as SVCurve;
                if (curve != null)
                {
                    attribList.Add(curve.Attrib);
                }
            }

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

            if (edSvc != null)
            {
                SVWpfControl variableDialog = new SVWpfControl();
                variableDialog.Width  = 100;
                variableDialog.Height = 100;

                SVWPFCurveSelect curveDialog = new SVWPFCurveSelect();
                curveDialog.listView.ItemsSource = attribList;
                variableDialog.addContent(curveDialog);
                edSvc.DropDownControl(variableDialog);

                SVCurveProperties obj = curveDialog.listView.SelectedItem as SVCurveProperties;
                if (obj != null)
                {
                    switch (svPanel.Attrib.ButtonType)
                    {
                    case 6:
                        svPanel.Attrib.BtnVarText = obj.ForwardControl;
                        break;

                    case 7:
                        svPanel.Attrib.BtnVarText = obj.CurControl;
                        break;

                    case 8:
                        svPanel.Attrib.BtnVarText = obj.BackwardControl;
                        break;
                    }

                    return(obj.ID.ToString());
                }
            }

            return(value);
        }
コード例 #2
0
        //建立一个副本
        override public object cloneObject()
        {
            MemoryStream    stream    = new MemoryStream();
            BinaryFormatter binFormat = new BinaryFormatter();

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

            result.refreshPropertyToPanel();

            return(result);
        }