示例#1
0
        private CustomShape EditPoints(ITypeDescriptorContext context, CustomShape shape)
        {
            CustomShapeEditorForm editor = new CustomShapeEditorForm();

            //editor.EditorControl.Dimension = shape.Dimension;

            //foreach (ShapePoint point in shape.Points)
            //{
            //    editor.EditorControl.Points.Add(new ShapePoint(point));
            //}

            shape = editor.EditShape(shape);

            //if (editor.ShowDialog() == DialogResult.OK)
            //{
            //IDesignerHost host = context.Container as IDesignerHost;
            //if (host != null)
            //{
            //    foreach (ShapePoint point in shape.Points)
            //    {
            //        host.DestroyComponent(point);
            //    }
            //}

            //shape.Points.Clear();

            //    foreach (ShapePoint point in editor.EditorControl.Points)
            //    {
            //        ShapePoint p = null;

            //        if (host != null)
            //        {
            //            p = (ShapePoint)host.CreateComponent(typeof(ShapePoint));
            //        }
            //        else
            //        {
            //            p = new ShapePoint();
            //        }

            //        p.X = point.X;
            //        p.Y = point.Y;
            //        p.ControlPoint1 = point.ControlPoint1;
            //        p.ControlPoint2 = point.ControlPoint2;
            //        p.Bezier = point.Bezier;
            //        p.Locked = point.Locked;
            //        shape.Points.Add(p);
            //    }

            //    shape.Dimension = editor.EditorControl.Dimension;
            //}

            return(shape);
        }
示例#2
0
        private void radButton3_Click(object sender, System.EventArgs e)
        {
            radioButton2.Checked = true;

            Telerik.WinControls.CustomShapeEditorForm form = new Telerik.WinControls.CustomShapeEditorForm();

            if (shape == null)
            {
                shape = new Telerik.WinControls.CustomShape(new Rectangle(0, 0, 320, 180));
            }

            shape = form.EditShape(shape);

            if (form.Result == DialogResult.OK)
            {
                radButton1.ButtonElement.Shape = shape;
            }
        }