Example #1
0
 private void SetControl_Circle_Passed_Values(ShapePopulate shapePopulate)
 {
     shapePopulate.DrawBorder  = bool.Parse(circleBorder_Retrieved);
     shapePopulate.ColorShape  = bool.Parse(circleColored_Retrieved);
     shapePopulate.BorderWidth = (int)circle_Border_Width_Numeric.Value;
     shapePopulate.ShapeColor  = circle_Color.BackColor;
     shapePopulate.BorderColor = circle_BorderColor.BackColor;
 }
Example #2
0
 private void SetControl_Pie_Passed_Values(ShapePopulate shapePopulate)
 {
     shapePopulate.DrawBorder  = bool.Parse(pieBorder_Retrieved);
     shapePopulate.ColorShape  = bool.Parse(pieColored_Retrieved);
     shapePopulate.BorderWidth = (int)pie_Border_Width_Numeric.Value;
     shapePopulate.ShapeColor  = pie_Color.BackColor;
     shapePopulate.BorderColor = pie_BorderColor.BackColor;
     shapePopulate.StartAngle  = pie_StartAngle_Retrieved;
     shapePopulate.EndAngle    = pie_EndAngle_Retrieved;
 }
Example #3
0
 private void SetControl_Polygon_Passed_Values(ShapePopulate shapePopulate)
 {
     shapePopulate.DrawBorder           = bool.Parse(polygonBorder_Retrieved);
     shapePopulate.ColorShape           = bool.Parse(polygonColored_Retrieved);
     shapePopulate.BorderWidth          = (int)polygon_Border_Width_Numeric.Value;
     shapePopulate.ShapeColor           = polygon_Color.BackColor;
     shapePopulate.BorderColor          = polygon_BorderColor.BackColor;
     shapePopulate.PolygonStartingAngle = polygonAngle_Retrieved;
     shapePopulate.PolygonSides         = polygonSides_Retrieved;
 }
Example #4
0
        private void SetControl_Rectangle_Passed_Values(ShapePopulate shapePopulate)
        {
            shapePopulate.Rounding    = bool.Parse(rectangleRounding_Retrieved);
            shapePopulate.DrawBorder  = bool.Parse(rectangleBorder_Retrieved);
            shapePopulate.ColorShape  = bool.Parse(rectangleColored_Retrieved);
            shapePopulate.Curve       = rectangleCurve_Retrieved;
            shapePopulate.BorderWidth = (int)rectangle_Border_Width_Numeric.Value;
            shapePopulate.ShapeColor  = rectangle_Color.BackColor;
            shapePopulate.BorderColor = rectangle_BorderColor.BackColor;

            shapePopulate.UpperLeftCurve  = rectangleCurve_UL_Retrieved * 4;
            shapePopulate.UpperRightCurve = rectangleCurve_UR_Retrieved * 4;
            shapePopulate.DownLeftCurve   = rectangleCurve_DL_Retrieved * 4;
            shapePopulate.DownRightCurve  = rectangleCurve_DR_Retrieved * 4;
        }
Example #5
0
        /// <summary>
        ///     Initializes a new instance of <c>FillerEditorDialog</c> using an existing <c>Filler</c>
        ///     at the default window position.
        /// </summary>
        /// <param name="shapePopulate">Existing <c>Filler</c> object.</param>
        /// <exception cref="System.ArgumentNullException">
        ///		Thrown if <paramref name="filler" /> is null.
        ///	</exception>
        public ShapeDialog(ShapePopulate shapePopulate)
        {
            if (shapePopulate == null)
            {
                throw new ArgumentNullException("shapePopulate");
            }


            InitializeComponent();
            //FillGradientComboBox();
            AdjustDialogSize();
            //Set_Rectangle_InitialValues();
            SetControls_Circle_To_Initial_Values(shapePopulate);
            SetControl_Rectangle_To_Initial_Values(shapePopulate);
            SetControls_Polygon_To_Initial_Values(shapePopulate);
            SetControls_Pie_To_Initial_Values(shapePopulate);
        }
            // This code allows the designer to generate the Shape constructor

            public override object ConvertTo(ITypeDescriptorContext context,
                                             CultureInfo culture,
                                             object value,
                                             Type destinationType)
            {
                if (value is ShapePopulate)
                {
                    if (destinationType == typeof(string))
                    {
                        // Display string in designer
                        return("(ShapePopulate)");
                    }
                    else if (destinationType == typeof(InstanceDescriptor))
                    {
                        ShapePopulate shapePopulate = (ShapePopulate)value;

                        if (shapePopulate.ShapeType == shapes.Rectangle)
                        {
                            ConstructorInfo ctor = typeof(ShapePopulate).GetConstructor(new Type[]
                            {
                                typeof(shapes),
                                typeof(Color),
                                typeof(Color),
                                typeof(bool),
                                typeof(bool),
                                typeof(bool),
                                typeof(int),
                                typeof(int),
                                typeof(int),
                                typeof(int),
                                typeof(int)
                            });
                            if (ctor != null)
                            {
                                return(new InstanceDescriptor(ctor, new object[] {
                                    shapePopulate.Rectangle,
                                    shapePopulate.bordercolor,
                                    shapePopulate.shapecolor,
                                    shapePopulate.rounding,
                                    shapePopulate.colorShape,
                                    shapePopulate.drawBorder,
                                    shapePopulate.curve,
                                    shapePopulate.upperLeftCurve,
                                    shapePopulate.upperRightCurve,
                                    shapePopulate.downLeftCurve,
                                    shapePopulate.downRightCurve
                                }));
                            }
                        }

                        else if (shapePopulate.ShapeType == shapes.Circle)
                        {
                            ConstructorInfo ctor = typeof(ShapePopulate).GetConstructor(new Type[] { typeof(shapes),
                                                                                                     typeof(Color),
                                                                                                     typeof(Color),
                                                                                                     typeof(bool),
                                                                                                     typeof(bool), });
                            if (ctor != null)
                            {
                                return(new InstanceDescriptor(ctor, new object[] { shapePopulate.Circle,
                                                                                   shapePopulate.bordercolor,
                                                                                   shapePopulate.shapecolor,
                                                                                   shapePopulate.colorShape,
                                                                                   shapePopulate.drawBorder, }));
                            }
                        }
                        else if (shapePopulate.ShapeType == shapes.Polygon)
                        {
                            ConstructorInfo ctor = typeof(ShapePopulate).GetConstructor(new Type[] { typeof(shapes),
                                                                                                     typeof(int),
                                                                                                     typeof(int) });
                            if (ctor != null)
                            {
                                return(new InstanceDescriptor(ctor, new object[] { shapePopulate.Polygon,
                                                                                   shapePopulate.sides,
                                                                                   shapePopulate.startingangle, }));
                            }
                        }
                        else if (shapePopulate.ShapeType == shapes.Pie)
                        {
                            ConstructorInfo ctor = typeof(ShapePopulate).GetConstructor(new Type[] { typeof(shapes),
                                                                                                     typeof(float),
                                                                                                     typeof(float),
                                                                                                     typeof(bool) });
                            if (ctor != null)
                            {
                                return(new InstanceDescriptor(ctor, new object[] { shapePopulate.Pie,
                                                                                   shapePopulate.startangle,
                                                                                   shapePopulate.endangle,
                                                                                   shapePopulate.pieDraw }));
                            }
                        }

                        else if (shapePopulate.ShapeType == shapes.None)
                        {
                            ConstructorInfo ctor = typeof(ShapePopulate).GetConstructor(new Type[] {
                                typeof(shapes),
                                typeof(bool),
                            });
                            if (ctor != null)
                            {
                                return(new InstanceDescriptor(ctor, new object[] {
                                    shapePopulate.None,
                                    shapePopulate.noneDraw,
                                }));
                            }
                        }


                        else
                        {
                            ConstructorInfo ctor = typeof(ShapePopulate).GetConstructor(Type.EmptyTypes);
                            if (ctor != null)
                            {
                                return(new InstanceDescriptor(ctor, null));
                            }
                        }
                    }
                }
                return(base.ConvertTo(context, culture, value, destinationType));
            }
Example #7
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (rectangle_RadioBtn.Checked)
            {
                try
                {
                    //shapePopulate = new ShapePopulate(
                    //    shapes.Rectangle,
                    //    Color.DeepSkyBlue,
                    //    Color.Yellow,true,false,true,
                    //    rectangleCurve_Retrieved,
                    //    rectangleCurve_UL_Retrieved,
                    //    rectangleCurve_UR_Retrieved,
                    //    rectangleCurve_DL_Retrieved,
                    //    rectangleCurve_DR_Retrieved);

                    shapePopulate = new ShapePopulate(
                        shapes.Rectangle,
                        Color.DeepSkyBlue,
                        Color.Yellow, true, false, true,
                        10,
                        10,
                        10,
                        10,
                        10);
                    SetControl_Rectangle_Passed_Values(shapePopulate);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                    this.Close();
                }
            }
            else if (circle_RadioBtn.Checked)
            {
                try
                {
                    shapePopulate = new ShapePopulate(shapes.Circle, Color.DeepSkyBlue,
                                                      Color.Yellow, true, false);
                    SetControl_Circle_Passed_Values(shapePopulate);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                    this.Close();
                }
            }
            else if (polygon_RadioBtn.Checked)
            {
                try
                {
                    shapePopulate = new ShapePopulate(shapes.Polygon, 3, 90);
                    SetControl_Polygon_Passed_Values(shapePopulate);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                    this.Close();
                }
            }

            else if (pie_RadioBtn.Checked)
            {
                try
                {
                    shapePopulate = new ShapePopulate(shapes.Pie, 3, 90, true);
                    SetControl_Pie_Passed_Values(shapePopulate);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                    this.Close();
                }
            }
            else if (none_RadioBtn.Checked)
            {
                shapePopulate = new ShapePopulate(shapes.None, true);
            }
            else
            {
                shapePopulate = ShapePopulate.Empty();
            }
            DialogResult = DialogResult.OK;
        }
Example #8
0
 /// <summary>
 ///		Initializes a new instance of <c>FillerEditorDialog</c> using an existing <c>Filler</c>
 ///		and positioned beneath the specified control.
 /// </summary>
 /// <param name="filler">Existing <c>Filler</c> object.</param>
 /// <param name="c">Control beneath which the dialog should be placed.</param>
 /// <exception cref="System.ArgumentNullException">
 ///		Thrown if <paramref name="filler" /> is null.
 ///	</exception>
 public ShapeDialog(ShapePopulate shapePopulate, Control c) : this(shapePopulate)
 {
     Draw.SetStartPositionBelowControl(this, c);
 }
Example #9
0
 /// <summary>
 ///		Initializes a new instance of <c>FillerEditorDialog</c> using an empty <c>Filler</c>
 ///		and positioned beneath the specified control.
 /// </summary>
 /// <param name="c">Control beneath which the dialog should be placed.</param>
 public ShapeDialog(Control c) : this(ShapePopulate.Empty(), c)
 {
 }
Example #10
0
        private void SetControls_Pie_To_Initial_Values(ShapePopulate shapePopulate)
        {
            pie_Border_Combo.SelectedIndex  = No;
            pie_Colored_Combo.SelectedIndex = No;


            if (shapePopulate.ShapeType == shapes.Pie)
            {
                pie_RadioBtn.Checked = true;

                pie_Border_Width_Numeric.Value = Convert.ToDecimal(shapePopulate.BorderWidth);
                pie_Color.BackColor            = shapePopulate.ShapeColor;
                pie_BorderColor.BackColor      = shapePopulate.BorderColor;
                pie_StartAngle_Numeric.Value   = Convert.ToDecimal(shapePopulate.StartAngle);
                pie_EndAngle_Numeric.Value     = Convert.ToDecimal(shapePopulate.EndAngle);


                pieShape.BorderWidth = shapePopulate.BorderWidth;
                pieShape.ShapeColor  = shapePopulate.ShapeColor;
                pieShape.BorderColor = shapePopulate.BorderColor;
                pieShape.StartAngle  = shapePopulate.StartAngle;
                pieShape.EndAngle    = shapePopulate.EndAngle;


                if (shapePopulate.DrawBorder == true)
                {
                    pie_Border_Combo.SelectedIndex = Yes;
                    pieShape.DrawBorder            = true;
                }
                else if (shapePopulate.DrawBorder == false)
                {
                    pie_Border_Combo.SelectedIndex = No;
                    pieShape.DrawBorder            = false;
                }

                if (shapePopulate.ColorShape == true)
                {
                    pie_Colored_Combo.SelectedIndex = Yes;
                    pieShape.ColorShape             = true;
                }
                else if (shapePopulate.ColorShape == false)
                {
                    pie_Colored_Combo.SelectedIndex = No;
                    pieShape.ColorShape             = false;
                }
            }



            else if (shapePopulate.ShapeType == shapes.Circle)
            {
                circle_RadioBtn.Checked = true;
            }
            else if (shapePopulate.ShapeType == shapes.Rectangle)
            {
                rectangle_RadioBtn.Checked = true;
            }
            else if (shapePopulate.ShapeType == shapes.Polygon)
            {
                polygon_RadioBtn.Checked = true;
            }
            else
            {
                none_RadioBtn.Checked = true;
            }
        }
Example #11
0
 /// <summary>
 ///		Initializes a new instance of <c>FillerEditorDialog</c> using an empty <c>Filler</c>
 ///     at the default window position.
 /// </summary>
 public ShapeDialog() : this(ShapePopulate.Empty())
 {
 }
Example #12
0
        private void SetControl_Rectangle_To_Initial_Values(ShapePopulate shapePopulate)
        {
            rectangle_Rounding_Combo.SelectedIndex = No;
            rectangle_Border_Combo.SelectedIndex   = No;
            rectangle_Colored_Combo.SelectedIndex  = No;

            rectangleCurve_UL_Retrieved = shapePopulate.UpperLeftCurve;
            rectangleCurve_UR_Retrieved = shapePopulate.UpperRightCurve;
            rectangleCurve_DL_Retrieved = shapePopulate.DownLeftCurve;
            rectangleCurve_DR_Retrieved = shapePopulate.DownRightCurve;

            rectangle_Border_UL.Text  = rectangleCurve_UL_Retrieved.ToString();
            rectangle_Border_UR.Text  = rectangleCurve_UR_Retrieved.ToString();
            rectangle_Border_DL.Text  = rectangleCurve_DL_Retrieved.ToString();
            rectangle_Border_DR.Text  = rectangleCurve_DR_Retrieved.ToString();
            rectangle_Border_ALL.Text = shapePopulate.Curve.ToString();

            rectangleShape.UpperLeftCurve  = shapePopulate.UpperLeftCurve;
            rectangleShape.UpperRightCurve = shapePopulate.UpperRightCurve;
            rectangleShape.DownLeftCurve   = shapePopulate.DownLeftCurve;
            rectangleShape.DownRightCurve  = shapePopulate.DownRightCurve;
            rectangleShape.Curve           = shapePopulate.Curve;


            rectangleShape.BorderWidth = (shapePopulate.BorderWidth) / 4;


            if (shapePopulate.ShapeType == shapes.Rectangle)
            {
                rectangle_RadioBtn.Checked = true;

                rectangle_Curve_Numeric.Value        = shapePopulate.Curve;
                rectangle_Border_Width_Numeric.Value = Convert.ToDecimal(shapePopulate.BorderWidth);
                rectangle_Color.BackColor            = shapePopulate.ShapeColor;
                rectangle_BorderColor.BackColor      = shapePopulate.BorderColor;



                rectangleShape.ShapeColor  = shapePopulate.ShapeColor;
                rectangleShape.BorderColor = shapePopulate.BorderColor;


                if (shapePopulate.Rounding == true)
                {
                    rectangle_Rounding_Combo.SelectedIndex = Yes;
                    rectangleShape.Rounding = true;
                }
                else if (shapePopulate.Rounding == false)
                {
                    rectangle_Rounding_Combo.SelectedIndex = No;
                    rectangleShape.Rounding = false;
                }

                if (shapePopulate.DrawBorder == true)
                {
                    rectangle_Border_Combo.SelectedIndex = Yes;
                    rectangleShape.DrawBorder            = true;
                }
                else if (shapePopulate.DrawBorder == false)
                {
                    rectangle_Border_Combo.SelectedIndex = No;
                    rectangleShape.DrawBorder            = false;
                }

                if (shapePopulate.ColorShape == true)
                {
                    rectangle_Colored_Combo.SelectedIndex = Yes;
                    rectangleShape.ColorShape             = true;
                }
                else if (shapePopulate.ColorShape == false)
                {
                    rectangle_Colored_Combo.SelectedIndex = No;
                    rectangleShape.ColorShape             = false;
                }
            }



            else if (shapePopulate.ShapeType == shapes.Circle)
            {
                circle_RadioBtn.Checked = true;
            }
            else if (shapePopulate.ShapeType == shapes.Polygon)
            {
                polygon_RadioBtn.Checked = true;
            }
            else if (shapePopulate.ShapeType == shapes.Pie)
            {
                pie_RadioBtn.Checked = true;
            }
            else
            {
                none_RadioBtn.Checked = true;
            }
        }