Beispiel #1
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                Pen spacer = new Pen(UI.Colour.SpacerColour);
                Pen pen    = new Pen(UI.Colour.BorderColour)
                {
                    Width = 0.5f
                };
                //Draw divider line
                if (SpacerTxt != "")
                {
                    graphics.DrawString(SpacerTxt, GH_FontServer.Small, UI.Colour.AnnotationTextDark, SpacerBounds, GH_TextRenderingConstants.CenterCenter);
                    graphics.DrawLine(spacer, SpacerBounds.X, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, GH_FontServer.Small)) / 2 - 4, SpacerBounds.Y + SpacerBounds.Height / 2);
                    graphics.DrawLine(spacer, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, GH_FontServer.Small)) / 2 + GH_FontServer.StringWidth(SpacerTxt, GH_FontServer.Small) + 4, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + SpacerBounds.Width, SpacerBounds.Y + SpacerBounds.Height / 2);
                }

                // Draw button box
                graphics.FillRectangle(UI.Colour.ButtonColor, ButtonBounds);
                graphics.DrawRectangle(pen, ButtonBounds.X, ButtonBounds.Y, ButtonBounds.Width, ButtonBounds.Height);
                graphics.DrawString(buttonText, GH_FontServer.Standard, UI.Colour.AnnotationTextBright, ButtonBounds, GH_TextRenderingConstants.CenterCenter);
            }
        }
Beispiel #2
0
        private int ComputeW_ico(IGH_Component owner)
        {
            GH_SwitcherComponent gH_SwitcherComponent = (GH_SwitcherComponent)owner;
            int num  = 24;
            int num2 = 0;
            int num3 = 0;

            foreach (IGH_Param componentInput in gH_SwitcherComponent.StaticData.GetComponentInputs())
            {
                int val = ((List <IGH_StateTag>)componentInput.StateTags).Count * 20;
                num3 = Math.Max(num3, val);
                num2 = Math.Max(num2, GH_FontServer.StringWidth(componentInput.NickName, StandardFont.font()));
            }
            num2  = Math.Max(num2 + 6, 12);
            num2 += num3;
            int num4 = 0;
            int num5 = 0;

            foreach (IGH_Param componentOutput in gH_SwitcherComponent.StaticData.GetComponentOutputs())
            {
                int val2 = ((List <IGH_StateTag>)componentOutput.StateTags).Count * 20;
                num5 = Math.Max(num5, val2);
                num4 = Math.Max(num4, GH_FontServer.StringWidth(componentOutput.NickName, StandardFont.font()));
            }
            num4  = Math.Max(num4 + 6, 12);
            num4 += num5;
            return(num2 + num + num4 + 6);
        }
Beispiel #3
0
        protected override void Layout()
        {
            switch (this.Owner.ListMode)
            {
            case GH_ValueListMode.CheckList:
                this.LayoutCheckList();
                break;

            case GH_ValueListMode.DropDown:
                this.LayoutDropDown();
                break;
            }
            this.ItemBounds = this.Bounds;
            RectangleF bounds  = this.Bounds;
            RectangleF bounds2 = new RectangleF(bounds.X, this.Bounds.Y, 0f, this.Bounds.Height);

            this.NameBounds = bounds2;
            if (this.Owner.DisplayName != null)
            {
                int nameWidth = GH_FontServer.StringWidth(this.Owner.DisplayName, GH_FontServer.Standard) + 10;
                bounds2         = this.Bounds;
                bounds          = new RectangleF(bounds2.X - (float)nameWidth, this.Bounds.Y, (float)nameWidth, this.Bounds.Height);
                this.NameBounds = bounds;
                this.Bounds     = RectangleF.Union(this.NameBounds, this.ItemBounds);
            }
        }
Beispiel #4
0
        // this function gets the coordinates from the probabilities, (same as getPts) but draws a HISTOGRAM shape an irregular polygon from points
        private PointF[] getHistoPts(List <double> Probabilities)

        {
            int n = (Probabilities.Count * 2) + 2;

            PointF[] points = new PointF[n];

            int width_nickname = GH_FontServer.StringWidth(Owner.NickName, GH_FontServer.Standard);


            points[0] = new PointF(this.Pivot.X + width_nickname, this.Pivot.Y - 7);
            points[1] = new PointF(this.Pivot.X + (Bounds.Width) - 11, this.Pivot.Y - 7);


            if (Probabilities.Count != 0)
            {
                int count = 0;
                // routine to get drawing coordinates based on bin  probabilities
                for (int i = 0; i < Probabilities.Count; i++)
                {
                    float rail_width = (int)(points[1].X - points[0].X);
                    float bin_width  = rail_width / Probabilities.Count;
                    float t          = (Probabilities.Count - i) / Probabilities.Count;

                    points[count + 2]     = new PointF((float)((this.Pivot.X + width_nickname) + (bin_width * (Probabilities.Count - i))), this.Pivot.Y - 7 - (glob.max_ht * (float)Probabilities[Probabilities.Count - i - 1]));
                    points[count + 2 + 1] = new PointF((float)((this.Pivot.X + width_nickname) + (bin_width * (Probabilities.Count - i - 1))), this.Pivot.Y - 7 - (glob.max_ht * (float)Probabilities[Probabilities.Count - i - 1]));
                    count += 2;
                }
            }

            return(points);
        }
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                GH_Capsule buttonCapsule = GH_Capsule.CreateTextCapsule(buttonRectangle, buttonRectangle, GH_Palette.Grey, ButtonText);
                buttonCapsule.Render(graphics, Selected, attributeOwner.Locked, false);
                buttonCapsule.Dispose();

                StringFormat format = new StringFormat
                {
                    Alignment     = StringAlignment.Center,
                    LineAlignment = StringAlignment.Center,
                    Trimming      = StringTrimming.EllipsisCharacter
                };
                if (GH_FontServer.StringWidth(TextLine.Long, this.TextFont) < Bounds.Width)
                {
                    graphics.DrawString(TextLine.Long, TextFont, Brushes.Black, textRectangle, format);
                }
                else
                {
                    graphics.DrawString(TextLine.Short, TextFont, Brushes.Black, textRectangle, format);
                }
                format.Dispose();
            }
        }
Beispiel #6
0
        // Rui
        // Calculate the background bays for the graph based on Probabilities
        // return a list of equal size rectangles as background for the render
        private RectangleF[] getBackgroundBins(List <double> Probabilities)
        {
            int n = Probabilities.Count;

            RectangleF[] backgroundBins = new RectangleF[n];

            PointF[] points = new PointF[n];

            int width_nickname = GH_FontServer.StringWidth(Owner.NickName, GH_FontServer.Standard);

            points[0] = new PointF(this.Pivot.X + width_nickname, this.Pivot.Y - 7);
            points[1] = new PointF(this.Pivot.X + (Bounds.Width) - 11, this.Pivot.Y - 7);

            if (Probabilities.Count != 0)
            {
                for (int i = 0; i < Probabilities.Count; i++)
                {
                    float rail_width = (int)(points[1].X - points[0].X);
                    float bin_width  = rail_width / Probabilities.Count;

                    backgroundBins[i] = new System.Drawing.RectangleF(
                        (float)((this.Pivot.X + width_nickname) + (bin_width * (Probabilities.Count - i - 1))),
                        (float)(this.Pivot.Y - 7 - glob.max_ht),
                        (float)bin_width,
                        (float)(glob.max_ht));
                }
            }

            return(backgroundBins);
        }
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                //We need to draw everything outselves.
                Color myColour = UI.Colour.GsaDarkBlue;
                Brush myBrush  = new SolidBrush(myColour);

                //Text boxes
                Brush activeFillBrush  = myBrush;
                Brush passiveFillBrush = Brushes.LightGray;
                Color borderColour     = myColour;
                Color passiveBorder    = Color.DarkGray;
                Brush annoText         = Brushes.Black;

                Font font = GH_FontServer.Standard;
                int  s    = 8;
                if (Grasshopper.CentralSettings.CanvasFullNames)
                {
                    s    = 10;
                    font = GH_FontServer.Standard;
                }

                // adjust fontsize to high resolution displays
                font = new Font(font.FontFamily, font.Size / GH_GraphicsUtil.UiScale, FontStyle.Regular);

                Font sml = GH_FontServer.Small;
                // adjust fontsize to high resolution displays
                sml = new Font(sml.FontFamily, sml.Size / GH_GraphicsUtil.UiScale, FontStyle.Regular);

                //draw the component
                base.RenderComponentCapsule(canvas, graphics, true, true, true, true, true, true);

                Pen pen = new Pen(borderColour);

                graphics.DrawString(SpacerTxt, sml, annoText, SpacerBounds, GH_TextRenderingConstants.CenterCenter);
                graphics.DrawLine(pen, SpacerBounds.X, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, sml)) / 2 - 4, SpacerBounds.Y + SpacerBounds.Height / 2);
                graphics.DrawLine(pen, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, sml)) / 2 + GH_FontServer.StringWidth(SpacerTxt, sml) + 4, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + SpacerBounds.Width, SpacerBounds.Y + SpacerBounds.Height / 2);

                graphics.DrawString("x", font, annoText, xTxtBounds, GH_TextRenderingConstants.CenterCenter);
                ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(xBounds.X + xBounds.Width / 2, xBounds.Y + xBounds.Height / 2), x, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                graphics.DrawString("y", font, annoText, yTxtBounds, GH_TextRenderingConstants.CenterCenter);
                ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(yBounds.X + yBounds.Width / 2, yBounds.Y + yBounds.Height / 2), y, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                graphics.DrawString("z", font, annoText, zTxtBounds, GH_TextRenderingConstants.CenterCenter);
                ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(zBounds.X + zBounds.Width / 2, zBounds.Y + zBounds.Height / 2), z, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                graphics.DrawString("xx", font, annoText, xxTxtBounds, GH_TextRenderingConstants.CenterCenter);
                ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(xxBounds.X + xxBounds.Width / 2, xxBounds.Y + xxBounds.Height / 2), xx, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                graphics.DrawString("yy", font, annoText, yyTxtBounds, GH_TextRenderingConstants.CenterCenter);
                ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(yyBounds.X + yyBounds.Width / 2, yyBounds.Y + yyBounds.Height / 2), yy, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                graphics.DrawString("zz", font, annoText, zzTxtBounds, GH_TextRenderingConstants.CenterCenter);
                ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(zzBounds.X + zzBounds.Width / 2, zzBounds.Y + zzBounds.Height / 2), zz, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);
            }
        }
Beispiel #8
0
        protected override void Layout()
        {
            int FontWidth = GH_FontServer.StringWidth(Owner.NickName, GH_FontServer.Standard);
            //10 is meanless
            float ComponentWidth = FontWidth + 2 * Setting.DROPDOWNCOMPONENTPARAMHEIGHT + Setting.DROPDOWNTRIANGLEHEIGHT + 10;
            SizeF BoundsSize     = new SizeF(ComponentWidth, Setting.DROPDOWNCOMPONENTHEIGHT);

            this.Owner.Attributes.Bounds = new RectangleF(Pivot, BoundsSize);
            base.AttributeUtil.ComputeFixPramGridBounds(Setting.DROPDOWNCOMPONENTPARAMHEIGHT);
        }
Beispiel #9
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                Pen spacer = new Pen(UI.Colour.SpacerColour);
                Pen pen    = new Pen(UI.Colour.GsaDarkBlue);
                if (displayText == initialTxt)
                {
                    pen = new Pen(UI.Colour.BorderColour);
                }
                pen.Width = 0.5f;
                //Draw divider line
                if (SpacerTxt != "")
                {
                    graphics.DrawString(SpacerTxt, GH_FontServer.Small, UI.Colour.AnnotationTextDark, SpacerBounds, GH_TextRenderingConstants.CenterCenter);
                    graphics.DrawLine(spacer, SpacerBounds.X, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, GH_FontServer.Small)) / 2 - 4, SpacerBounds.Y + SpacerBounds.Height / 2);
                    graphics.DrawLine(spacer, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, GH_FontServer.Small)) / 2 + GH_FontServer.StringWidth(SpacerTxt, GH_FontServer.Small) + 4, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + SpacerBounds.Width, SpacerBounds.Y + SpacerBounds.Height / 2);
                }

                // Draw selected item
                Font  font       = new Font(GH_FontServer.FamilyStandard, 7);
                Brush fontColour = UI.Colour.AnnotationTextDark;
                // background
                Brush background = new SolidBrush(UI.Colour.GsaLightGrey);
                graphics.FillRectangle(background, BorderBound); // background
                // border
                graphics.DrawRectangle(pen, BorderBound.X, BorderBound.Y, BorderBound.Width, BorderBound.Height);
                // text
                graphics.DrawString(displayText, (displayText == initialTxt) ? GH_FontServer.Small : font, (displayText == initialTxt) ? Brushes.Gray : fontColour, TextBound, GH_TextRenderingConstants.NearCenter);
                // draw dropdown arrow
                ButtonsUI.DropDownArrow.DrawDropDownButton(graphics, new PointF(ButtonBound.X + ButtonBound.Width / 2, ButtonBound.Y + ButtonBound.Height / 2), UI.Colour.GsaDarkBlue, 15);

                // draw dropdown list
                if (unfolded)
                {
                    Pen   penborder          = new Pen(Brushes.Gray);
                    Brush dropdownbackground = new SolidBrush(UI.Colour.GsaLightGrey);
                    penborder.Width = 0.3f;
                    for (int i = 0; i < dropdownlist.Count; i++)
                    {
                        // background
                        graphics.FillRectangle(dropdownbackground, dropdownBounds[i]);
                        // border
                        graphics.DrawRectangle(penborder, dropdownBounds[i].X, dropdownBounds[i].Y, dropdownBounds[i].Width, dropdownBounds[i].Height);
                        // text
                        graphics.DrawString(dropdownlist[i], font, fontColour, dropdownBounds[i], GH_TextRenderingConstants.NearCenter);
                    }

                    // border
                    graphics.DrawRectangle(pen, dropdownBound.X, dropdownBound.Y, dropdownBound.Width, dropdownBound.Height);
                }
            }
        }
Beispiel #10
0
        private int ItemMaximumWidth()
        {
            int num2 = 20;

            foreach (GuanacoListItem item in this.Owner.ListItems)
            {
                int num3 = GH_FontServer.StringWidth(item.Name, GH_FontServer.Standard);
                num2 = Math.Max(num2, num3);
            }
            return(num2 + 10);
        }
        private int ItemMaximumWidth()
        {
            int val1 = 20;

            foreach (GH_ValueListItem listItem in Owner.ListItems)
            {
                int val2 = GH_FontServer.StringWidth(listItem.Name, GH_FontServer.Standard);
                val1 = Math.Max(val1, val2);
            }
            return(val1 + 10);
        }
Beispiel #12
0
        protected override void Layout()
        {
            //Fixed the Component Size;
            int FontWidth = GH_FontServer.StringWidth(Owner.NickName, GH_FontServer.Standard);
            //10 is meanless
            float ComponentWidth = FontWidth + 2 * ParamWidth + TriangleSize + 10;
            SizeF BoundsSize     = new SizeF(ComponentWidth, Setting.DROPDOWNCOMPONENTHEIGHT);

            //Pivot非常的重要
            this.Owner.Attributes.Bounds = new RectangleF(Pivot, BoundsSize);
            this.ComputeParamGridBounds();
        }
Beispiel #13
0
        private Transform CalculateTextPlane()
        {
            string Text = this.TextObj.Text;

            System.Drawing.Font _Font = new System.Drawing.Font(this.TextObj.Font.FaceName, Convert.ToSingle(this.TextObj.TextHeight));

            int       Width = GH_FontServer.StringWidth(Text, _Font);
            int       Height = _Font.Height;
            Plane     originPlane = this.TextObj.Plane;
            Transform H_Tran = new Transform(), V_Tran = new Transform();
            Vector3d  H_Vector, V_Vector;

            switch (this.TextObj.TextHorizontalAlignment)
            {
            case TextHorizontalAlignment.Center:
                H_Vector = originPlane.XAxis * Width * (-0.5);
                break;

            case TextHorizontalAlignment.Left:
                H_Vector = originPlane.XAxis;
                break;

            case TextHorizontalAlignment.Right:
                H_Vector = originPlane.XAxis * Width * (-1);
                break;

            default:
                H_Vector = originPlane.XAxis;
                break;
            }
            switch (this.TextObj.TextVerticalAlignment)
            {
            case TextVerticalAlignment.Bottom:
                V_Vector = originPlane.YAxis;
                break;

            case TextVerticalAlignment.Middle:
                V_Vector = originPlane.YAxis * Height * 0.5;
                break;

            case TextVerticalAlignment.Top:
                V_Vector = originPlane.YAxis * Height * 1;
                break;

            default:
                V_Vector = originPlane.YAxis;
                break;
            }
            H_Tran = Transform.Translation(H_Vector);
            V_Tran = Transform.Translation(V_Vector);

            return(Transform.Multiply(H_Tran, V_Tran));
        }
Beispiel #14
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                Pen spacer = new Pen(ButtonColours.SpacerColour);

                Font font = GH_FontServer.Standard;
                // adjust fontsize to high resolution displays
                font = new Font(font.FontFamily, font.Size / GH_GraphicsUtil.UiScale, FontStyle.Regular);

                Font sml = GH_FontServer.Small;
                // adjust fontsize to high resolution displays
                sml = new Font(sml.FontFamily, sml.Size / GH_GraphicsUtil.UiScale, FontStyle.Regular);

                //Draw divider line
                if (SpacerTxt != "")
                {
                    graphics.DrawString(SpacerTxt, sml, ButtonColours.AnnotationTextDark, SpacerBounds, GH_TextRenderingConstants.CenterCenter);
                    graphics.DrawLine(spacer, SpacerBounds.X, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, sml)) / 2 - 4, SpacerBounds.Y + SpacerBounds.Height / 2);
                    graphics.DrawLine(spacer, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, sml)) / 2 + GH_FontServer.StringWidth(SpacerTxt, sml) + 4, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + SpacerBounds.Width, SpacerBounds.Y + SpacerBounds.Height / 2);
                }

                // Draw button box
                System.Drawing.Drawing2D.GraphicsPath button = RoundedRect(ButtonBounds, 2);

                Brush normal_colour  = ButtonColours.ButtonColor;
                Brush hover_colour   = ButtonColours.HoverButtonColour;
                Brush clicked_colour = ButtonColours.ClickedButtonColour;

                Brush butCol = (mouseOver) ? hover_colour : normal_colour;
                graphics.FillPath(mouseDown ? clicked_colour : butCol, button);

                // draw button edge
                Color edgeColor = ButtonColours.BorderColour;
                Color edgeHover = ButtonColours.HoverBorderColour;
                Color edgeClick = ButtonColours.ClickedBorderColour;
                Color edgeCol   = (mouseOver) ? edgeHover : edgeColor;
                Pen   pen       = new Pen(mouseDown ? edgeClick : edgeCol)
                {
                    Width = (mouseDown) ? 0.8f : 0.5f
                };
                graphics.DrawPath(pen, button);

                System.Drawing.Drawing2D.GraphicsPath overlay = RoundedRect(ButtonBounds, 2, true);
                graphics.FillPath(new SolidBrush(Color.FromArgb(mouseDown ? 0 : mouseOver ? 40 : 60, 255, 255, 255)), overlay);

                // draw button text
                graphics.DrawString(buttonText, font, ButtonColours.AnnotationTextBright, ButtonBounds, GH_TextRenderingConstants.CenterCenter);
            }
        }
        protected override void Layout()
        {
            switch (Owner.ListMode)
            {
            case GH_ValueListMode.CheckList:
                LayoutCheckList();
                break;

            case GH_ValueListMode.DropDown:
                LayoutDropDown();
                break;

            default:
                LayoutSequence();
                break;
            }

            ItemBounds = Bounds;
            RectangleF bounds1 = Bounds;
            //RectangleF rectangleF;
            RectangleF local1;
            double     x       = (double)bounds1.X;
            RectangleF bounds2 = Bounds;
            double     y1      = (double)bounds2.Y;

            bounds2 = Bounds;
            double height1 = (double)bounds2.Height;

            local1     = new RectangleF((float)x, (float)y1, 0.0f, (float)height1);
            NameBounds = local1;
            if (Owner.DisplayName == null)
            {
                return;
            }
            int        num1    = GH_FontServer.StringWidth(Owner.DisplayName, GH_FontServer.Standard) + 10;
            RectangleF bounds3 = Bounds;
            RectangleF local2;
            double     num2 = (double)bounds3.X - (double)num1;

            bounds2 = Bounds;
            double y2   = (double)bounds2.Y;
            double num3 = (double)num1;

            bounds2 = Bounds;
            double height2 = (double)bounds2.Height;

            local2     = new RectangleF((float)num2, (float)y2, (float)num3, (float)height2);
            NameBounds = bounds1;
            Bounds     = RectangleF.Union(NameBounds, ItemBounds);
        }
        protected override void Layout()
        {
            // Compute the width of the NickName of the owner (plus some extra padding),
            // then make sure we have at least 80 pixels.
            int width = GH_FontServer.StringWidth(Owner.NickName, GH_FontServer.Standard);

            width = Math.Max(width + 10, 80);

            // The height of our object is always 60 pixels
            int height = 60;

            // Assign the width and height to the Bounds property.
            // Also, make sure the Bounds are anchored to the Pivot
            Bounds = new RectangleF(Pivot, new SizeF(width, height));
        }
Beispiel #17
0
        protected override void Layout()
        {
            Pivot = GH_Convert.ToPoint(Pivot);
            Size size = new Size(150, 18);

            size.Width = Math.Max(size.Width, GH_FontServer.StringWidth(base.Owner.NickName, GH_FontServer.StandardAdjusted) + 20);
            int num  = Convert.ToInt32((double)Pivot.X - 0.5 * (double)size.Width);
            int num2 = Convert.ToInt32((double)Pivot.X + 0.5 * (double)size.Width);
            int num3 = Convert.ToInt32((double)Pivot.Y - 0.5 * (double)size.Height);
            int num4 = Convert.ToInt32((double)Pivot.Y + 0.5 * (double)size.Height);

            Bounds    = RectangleF.FromLTRB(num, num3, num2, num4);
            TextBound = RectangleF.FromLTRB(num + 30, num3, num2, num4);
            m_button  = new RectangleF(Bounds.Left, Bounds.Top, 30, Bounds.Height);
        }
Beispiel #18
0
        public static float MaxTextWidth(List <string> spacerTxts, Font font)
        {
            float sp = new float(); //width of spacer text

            // adjust fontsize to high resolution displays
            font = new Font(font.FontFamily, font.Size / GH_GraphicsUtil.UiScale, FontStyle.Regular);

            for (int i = 0; i < spacerTxts.Count; i++)
            {
                if (GH_FontServer.StringWidth(spacerTxts[i], font) + 8 > sp)
                {
                    sp = GH_FontServer.StringWidth(spacerTxts[i], font) + 8;
                }
            }
            return(sp);
        }
Beispiel #19
0
        protected override void Layout()
        {
            this.LayoutDropDown();

            this.ItemBounds = this.Bounds;
            RectangleF bounds = this.Bounds;
            RectangleF ef5    = new RectangleF(bounds.X, this.Bounds.Y, 0f, this.Bounds.Height);

            this.NameBounds = ef5;
            if (this.Owner.DisplayName != null)
            {
                int num = GH_FontServer.StringWidth(this.Owner.DisplayName, GH_FontServer.Standard) + 10;
                bounds          = new RectangleF(this.Bounds.X - num, this.Bounds.Y, (float)num, this.Bounds.Height);
                this.NameBounds = bounds;
                this.Bounds     = RectangleF.Union(this.NameBounds, this.ItemBounds);
            }
        }
Beispiel #20
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                //Draw divider line
                if (SpacerTxt != "")
                {
                    Pen  spacer = new Pen(UI.Colour.SpacerColour);
                    Font sml    = GH_FontServer.Small;
                    // adjust fontsize to high resolution displays
                    sml = new Font(sml.FontFamily, sml.Size / GH_GraphicsUtil.UiScale, FontStyle.Regular);

                    graphics.DrawString(SpacerTxt, sml, UI.Colour.AnnotationTextDark, SpacerBounds, GH_TextRenderingConstants.CenterCenter);
                    graphics.DrawLine(spacer, SpacerBounds.X, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, sml)) / 2 - 4, SpacerBounds.Y + SpacerBounds.Height / 2);
                    graphics.DrawLine(spacer, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, sml)) / 2 + GH_FontServer.StringWidth(SpacerTxt, sml) + 4, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + SpacerBounds.Width, SpacerBounds.Y + SpacerBounds.Height / 2);
                }

                // draw drag line and intervals
                Pen line = new Pen(UI.Colour.GsaDarkGrey);
                graphics.DrawLine(line, new PointF(SliderBound.X + GrabBound.Width / 2, SliderBound.Y + SliderBound.Height / 2), new PointF(SliderBound.X + SliderBound.Width - GrabBound.Width / 2, SliderBound.Y + SliderBound.Height / 2));
                //graphics.DrawLine(line, new PointF(BorderBound.X + GrabBound.Width / 2, BorderBound.Y + BorderBound.Height / 3), new PointF(BorderBound.X + GrabBound.Width / 2, BorderBound.Y + BorderBound.Height * 2 / 3));
                //graphics.DrawLine(line, new PointF(BorderBound.X + BorderBound.Width - GrabBound.Width / 2, BorderBound.Y + BorderBound.Height / 3), new PointF(BorderBound.X + BorderBound.Width - GrabBound.Width / 2, BorderBound.Y + BorderBound.Height * 2 / 3));

                // draw grab item
                Pen pen = new Pen(UI.Colour.GsaDarkBlue);
                pen.Width = 2f;
                RectangleF button = new RectangleF(GrabBound.X, GrabBound.Y, GrabBound.Width, GrabBound.Height);
                button.Inflate(-2, -2);
                Brush fill = new SolidBrush(UI.Colour.GsaLightGrey);
                graphics.FillEllipse(fill, button);
                graphics.DrawEllipse(pen, button);

                // Draw display value text
                Font font = new Font(GH_FontServer.FamilyStandard, 7);
                // adjust fontsize to high resolution displays
                font = new Font(font.FontFamily, font.Size / GH_GraphicsUtil.UiScale, FontStyle.Regular);
                string val = string.Format(new System.Globalization.NumberFormatInfo()
                {
                    NumberDecimalDigits = noDigits
                }, "{0:F}", new decimal(CurrentValue));

                graphics.DrawString(val, font, UI.Colour.AnnotationTextDark, SliderValTextBound, ((CurrentValue - MinValue) / (MaxValue - MinValue) < 0.5) ? GH_TextRenderingConstants.NearCenter : GH_TextRenderingConstants.FarCenter);
            }
        }
Beispiel #21
0
        protected override void Layout()
        {
            // only layout dropdown
            this.LayoutDropDown();

            this.ItemBounds = this.Bounds;
            System.Drawing.RectangleF bounds  = this.Bounds;
            System.Drawing.RectangleF bounds2 = new System.Drawing.RectangleF(bounds.X, this.Bounds.Y, 0f, this.Bounds.Height);
            this.NameBounds = bounds2;
            if (this.Owner.DisplayName != null)
            {
                int nameWidth = GH_FontServer.StringWidth(this.Owner.DisplayName, GH_FontServer.Standard) + 10;
                bounds2         = this.Bounds;
                bounds          = new System.Drawing.RectangleF(bounds2.X - (float)nameWidth, this.Bounds.Y, (float)nameWidth, this.Bounds.Height);
                this.NameBounds = bounds;
                this.Bounds     = System.Drawing.RectangleF.Union(this.NameBounds, this.ItemBounds);
            }
        }
        public GH_Project_Attributes(GH_Project_Component owner) : base(owner)
        {
            _checkboxPanelHeight = 2 * CHECKBOXHEIGHT + 3 * CHECKBOXPANELPADDING;
            _buttonPanelHeight   = BUTTONSIZE + 2 * BUTTONPANELPADDING;

            _topLabelString      = owner.Name;
            _topLabelStringWidth = GH_FontServer.StringWidth(_topLabelString, GH_FontServer.LargeAdjusted);

            _calcBtn = new PButton("Calculate", owner.PrepareCalculation);

            _cbStream           = new PCheckBox("Stream dat", owner.ToggleStream, owner.StreamContent);
            _cbSilent           = new PCheckBox("Silent calculation", owner.ToggleSilent, owner.SilentCalc);
            _cbStream.IsEnabled = true;
            _cbSilent.IsEnabled = true;

            _btnOpenExplorer = new PButton(owner.IconOpenExplorer, owner.OpenPath);
            _btnTeddy        = new PButton(owner.IconTeddy, owner.OpenTeddy);
            _btnAnimator     = new PButton(owner.IconAnimator, owner.OpenAnimator);
            _btnGraphic      = new PButton(owner.IconGraphic, owner.OpenGraphic);
            _btnResult       = new PButton(owner.IconResult, owner.OpenResult);
            _btnReport       = new PButton(owner.IconReport, owner.OpenReport);
        }
Beispiel #23
0
        private int ItemMaximumWidth()
        {
            int max = 20;

            try
            {
                System.Collections.Generic.List <GH_ValueListItem> .Enumerator enumerator = this.Owner.ListItems.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    GH_ValueListItem item = enumerator.Current;
                    int width             = GH_FontServer.StringWidth(item.Name, GH_FontServer.Standard);
                    max = System.Math.Max(max, width);
                }
            }
            finally
            {
                System.Collections.Generic.List <GH_ValueListItem> .Enumerator enumerator = new List <GH_ValueListItem> .Enumerator();

                ((System.IDisposable)enumerator).Dispose();
            }
            return(max + 10);
        }
Beispiel #24
0
        public NumericUpDown(string name, string description, T value, T min, T max, T smallChange, string formatString = "", Bitmap toolTipDiagram = null) : base(name, description, value, toolTipDiagram)
        {
            FormatString = formatString;
            _smallChange = smallChange;
            _min         = min;
            _max         = max;
            _btnWidh     = GH_FontServer.StringWidth("<", SmallFont);
            _labelWidth  = GH_FontServer.StringWidth("888.888", SmallFont);
            _titleWidth  = GH_FontServer.StringWidth(Name, SmallFont);
            _width       = _labelWidth + 2 * _btnWidh + 2 * Offset + _titleWidth;
            _height      = GH_FontServer.MeasureString("A", SmallFont).Height + 2 * Offset;

            _left  = new PushButton("Up", "Increase", "<");
            _right = new PushButton("Down", "Decrease", ">");
            _label = new PushButton("Value", description, AsString(value), true, null, _labelWidth);
            _left.UpdateSolution   = false; _right.UpdateSolution = false; _label.UpdateSolution = false;
            _left.OnValueChanged  += _left_OnValueChanged;
            _right.OnValueChanged += _right_OnValueChanged;
            _label.OnValueChanged += _label_OnValueChanged;
            _controls              = new GHControl[] { _left, _label, _right };
            timer          = new System.Timers.Timer();
            timer.Interval = 100;
            timer.Elapsed += Timer_Elapsed;
        }
Beispiel #25
0
        public CardPart(Bitmap icon, string text, Color fontColor, float extraWidth, float maxTextWidth)
        {
            Icon         = icon;
            Text         = text;
            Font         = TaskCardConstants.PartFont;
            FontColor    = fontColor;
            MaxTextWidth = maxTextWidth;

            float width = extraWidth;

            if (HasIcon)
            {
                width += TaskCardConstants.PartIconWidth;
            }
            if (HasIcon && HasText)
            {
                width += TaskCardConstants.PaddingH;
            }
            if (HasText)
            {
                width += Math.Min(MaxTextWidth, (float)GH_FontServer.StringWidth(text, Font));
            }
            Size = new SizeF(width, TaskCardConstants.PartHeight);
        }
Beispiel #26
0
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                float width   = 200;
                float width2  = 120;
                float height  = Bounds.Height;
                float margin  = 8;
                float spacing = GH_FontServer.StandardBold.GetHeight() * 1.05f;
                float left    = Pivot.X - (width - 50) + margin;
                float top     = Pivot.Y - height / 2 + margin;
                graphics.FillRectangle(new SolidBrush(Color.FromArgb(30, 38, 42)), new RectangleF(new PointF(left, top), new SizeF(width2, height - margin * 2)));
                graphics.DrawString("Project", GH_FontServer.StandardBold, Brushes.LightGray, new PointF(left + margin, top + margin));
                if (((SOMFLUX)Owner).myControlPanel != null)
                {
                    graphics.DrawString(((SOMFLUX)Owner).myControlPanel.project, GH_FontServer.StandardBold, Brushes.White, new PointF(left + margin, top + margin + spacing));
                }
                graphics.DrawString("Key", GH_FontServer.StandardBold, Brushes.LightGray, new PointF(left + margin, top + margin + spacing * 2 + 20));
                if (((SOMFLUX)Owner).myControlPanel != null)
                {
                    graphics.DrawString(((SOMFLUX)Owner).myControlPanel.key, GH_FontServer.StandardBold, Brushes.White, new PointF(left + margin, top + margin + spacing * 3 + 20));
                }
                graphics.DrawString("repo", GH_FontServer.StandardBold, Brushes.Gray, new PointF(left + margin, top + margin + spacing * 4.8f + 20));
                string rrepo = ((SOMFLUX)Owner).repo;
                if (GH_FontServer.StringWidth(((SOMFLUX)Owner).repo, GH_FontServer.StandardBold) > 104)
                {
                    int    W      = GH_FontServer.StringWidth(((SOMFLUX)Owner).repo, GH_FontServer.StandardBold);
                    double length = ((SOMFLUX)Owner).repo.Length;
                    double www    = GH_FontServer.StringWidth(((SOMFLUX)Owner).repo, GH_FontServer.StandardBold);
                    rrepo = ((SOMFLUX)Owner).repo.Substring(0, (int)(length * 104d / www));
                }
                graphics.DrawString(rrepo, GH_FontServer.StandardBold, Brushes.White, new PointF(left + margin, top + margin + spacing * 5.8f + 20));
            }
        }
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                Pen spacer = new Pen(UI.Colour.SpacerColour);

                Font font = GH_FontServer.Standard;
                // adjust fontsize to high resolution displays
                font = new Font(font.FontFamily, font.Size / GH_GraphicsUtil.UiScale, FontStyle.Regular);

                Font sml = GH_FontServer.Small;
                // adjust fontsize to high resolution displays
                sml = new Font(sml.FontFamily, sml.Size / GH_GraphicsUtil.UiScale, FontStyle.Regular);

                //Draw divider line
                if (SpacerTxt != "")
                {
                    graphics.DrawString(SpacerTxt, sml, UI.Colour.AnnotationTextDark, SpacerBounds, GH_TextRenderingConstants.CenterCenter);
                    graphics.DrawLine(spacer, SpacerBounds.X, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, sml)) / 2 - 4, SpacerBounds.Y + SpacerBounds.Height / 2);
                    graphics.DrawLine(spacer, SpacerBounds.X + (SpacerBounds.Width - GH_FontServer.StringWidth(SpacerTxt, sml)) / 2 + GH_FontServer.StringWidth(SpacerTxt, sml) + 4, SpacerBounds.Y + SpacerBounds.Height / 2, SpacerBounds.X + SpacerBounds.Width, SpacerBounds.Y + SpacerBounds.Height / 2);
                }

                // ### button 1 ###
                // Draw button box
                System.Drawing.Drawing2D.GraphicsPath button1 = UI.ButtonsUI.Button.RoundedRect(Button1Bounds, 2);

                Brush normal_colour1  = UI.Colour.ButtonColour;
                Brush hover_colour1   = UI.Colour.HoverButtonColour;
                Brush clicked_colour1 = UI.Colour.ClickedButtonColour;

                Brush butCol1 = (mouseOver1) ? hover_colour1 : normal_colour1;
                graphics.FillPath(mouseDown1 ? clicked_colour1 : butCol1, button1);

                // draw button edge
                Color edgeColor1 = UI.Colour.ButtonBorderColour;
                Color edgeHover1 = UI.Colour.HoverBorderColour;
                Color edgeClick1 = UI.Colour.ClickedBorderColour;
                Color edgeCol1   = (mouseOver1) ? edgeHover1 : edgeColor1;
                Pen   pen1       = new Pen(mouseDown1 ? edgeClick1 : edgeCol1)
                {
                    Width = (mouseDown1) ? 0.8f : 0.5f
                };
                graphics.DrawPath(pen1, button1);

                // draw button text
                graphics.DrawString(button1Text, font, UI.Colour.AnnotationTextBright, Button1Bounds, GH_TextRenderingConstants.CenterCenter);


                // ### button 2 ###
                // Draw button box
                System.Drawing.Drawing2D.GraphicsPath button2 = UI.ButtonsUI.Button.RoundedRect(Button2Bounds, 2);

                Brush normal_colour2  = UI.Colour.ButtonColour;
                Brush hover_colour2   = UI.Colour.HoverButtonColour;
                Brush clicked_colour2 = UI.Colour.ClickedButtonColour;

                Brush butCol2 = (mouseOver2) ? hover_colour2 : normal_colour2;
                graphics.FillPath(mouseDown2 ? clicked_colour2 : butCol2, button2);

                // draw button edge
                Color edgeColor2 = UI.Colour.ButtonBorderColour;
                Color edgeHover2 = UI.Colour.HoverBorderColour;
                Color edgeClick2 = UI.Colour.ClickedBorderColour;
                Color edgeCol2   = (mouseOver2) ? edgeHover2 : edgeColor2;
                Pen   pen2       = new Pen(mouseDown2 ? edgeClick2 : edgeCol2)
                {
                    Width = (mouseDown2) ? 0.8f : 0.5f
                };
                graphics.DrawPath(pen2, button2);

                // draw button text
                graphics.DrawString(button2Text, font, UI.Colour.AnnotationTextBright, Button2Bounds, GH_TextRenderingConstants.CenterCenter);

                // ### button 3 ###
                // Draw button box
                System.Drawing.Drawing2D.GraphicsPath button3 = UI.ButtonsUI.Button.RoundedRect(Button3Bounds, 2);

                Brush normal_colour3  = UI.Colour.ButtonColour;
                Brush hover_colour3   = UI.Colour.HoverButtonColour;
                Brush clicked_colour3 = UI.Colour.ClickedButtonColour;

                Brush butCol3 = (mouseOver3) ? hover_colour3 : normal_colour3;
                graphics.FillPath(mouseDown3 ? clicked_colour3 : butCol3, button3);

                // draw button edge
                Color edgeColor3 = UI.Colour.ButtonBorderColour;
                Color edgeHover3 = UI.Colour.HoverBorderColour;
                Color edgeClick3 = UI.Colour.ClickedBorderColour;
                Color edgeCol3   = (mouseOver3) ? edgeHover3 : edgeColor3;
                Pen   pen3       = new Pen(mouseDown3 ? edgeClick3 : edgeCol3)
                {
                    Width = (mouseDown3) ? 0.8f : 0.5f
                };
                graphics.DrawPath(pen3, button3);

                // draw button text
                graphics.DrawString(button3Text, font, UI.Colour.AnnotationTextBright, Button3Bounds, GH_TextRenderingConstants.CenterCenter);
            }
        }
        /// <summary>
        /// Width of the item
        /// </summary>
        /// <returns></returns>
        internal override int GetWidth()
        {
            int width = ShowTitle ? GH_FontServer.StringWidth(Name, SmallFont) : 0;

            return((_image == null) ? Offset + width : Offset + _image.Width + width);
        }
Beispiel #29
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                Pen spacer = new Pen(UI.Colour.SpacerColour);
                Pen pen    = new Pen(UI.Colour.GsaDarkBlue)
                {
                    Width = 0.5f
                };

                for (int i = 0; i < dropdownlists.Count; i++)
                {
                    //Draw divider line
                    if (spacerTxts[i] != "")
                    {
                        graphics.DrawString(spacerTxts[i], GH_FontServer.Small, UI.Colour.AnnotationTextDark, SpacerBounds[i], GH_TextRenderingConstants.CenterCenter);
                        graphics.DrawLine(spacer, SpacerBounds[i].X, SpacerBounds[i].Y + SpacerBounds[i].Height / 2, SpacerBounds[i].X + (SpacerBounds[i].Width - GH_FontServer.StringWidth(spacerTxts[i], GH_FontServer.Small)) / 2 - 4, SpacerBounds[i].Y + SpacerBounds[i].Height / 2);
                        graphics.DrawLine(spacer, SpacerBounds[i].X + (SpacerBounds[i].Width - GH_FontServer.StringWidth(spacerTxts[i], GH_FontServer.Small)) / 2 + GH_FontServer.StringWidth(spacerTxts[i], GH_FontServer.Small) + 4, SpacerBounds[i].Y + SpacerBounds[i].Height / 2, SpacerBounds[i].X + SpacerBounds[i].Width, SpacerBounds[i].Y + SpacerBounds[i].Height / 2);
                    }

                    // Draw selected item
                    // set font and colour depending on inital or selected text
                    Font  font       = new Font(GH_FontServer.FamilyStandard, 7);
                    Brush fontColour = UI.Colour.AnnotationTextDark;
                    if (initialTxts != null)
                    {
                        if (displayTexts[i] == initialTxts[i])
                        {
                            pen        = new Pen(UI.Colour.BorderColour);
                            font       = GH_FontServer.Small;
                            fontColour = Brushes.Gray;
                        }
                    }

                    // background
                    Brush background = new SolidBrush(UI.Colour.GsaLightGrey);
                    graphics.FillRectangle(background, BorderBound[i]); // background
                                                                        // border
                    graphics.DrawRectangle(pen, BorderBound[i].X, BorderBound[i].Y, BorderBound[i].Width, BorderBound[i].Height);
                    // text
                    graphics.DrawString(displayTexts[i], font, fontColour, TextBound[i], GH_TextRenderingConstants.NearCenter);
                    // draw dropdown arrow460a2412-ce15-49a6-b8da-e512ba92eeec
                    ButtonsUI.DropDownArrow.DrawDropDownButton(graphics, new PointF(ButtonBound[i].X + ButtonBound[i].Width / 2, ButtonBound[i].Y + ButtonBound[i].Height / 2), UI.Colour.GsaDarkBlue, 15);

                    // draw dropdown list
                    font       = new Font(GH_FontServer.FamilyStandard, 7);
                    fontColour = UI.Colour.AnnotationTextDark;
                    if (unfolded[i])
                    {
                        Pen   penborder          = new Pen(Brushes.Gray);
                        Brush dropdownbackground = new SolidBrush(UI.Colour.GsaLightGrey);
                        penborder.Width = 0.3f;
                        for (int j = 0; j < dropdownBounds[i].Count; j++)
                        {
                            // background
                            graphics.FillRectangle(dropdownbackground, dropdownBounds[i][j]);
                            // border
                            graphics.DrawRectangle(penborder, dropdownBounds[i][j].X, dropdownBounds[i][j].Y, dropdownBounds[i][j].Width, dropdownBounds[i][j].Height);
                            // text
                            graphics.DrawString(dropdownlists[i][j], font, fontColour, dropdownBounds[i][j], GH_TextRenderingConstants.NearCenter);
                        }
                        // border
                        graphics.DrawRectangle(pen, dropdownBound[i].X, dropdownBound[i].Y, dropdownBound[i].Width, dropdownBound[i].Height);
                    }
                }
            }
        }
Beispiel #30
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                Pen spacer = new Pen(UI.Colour.SpacerColour);
                Pen pen    = new Pen(UI.Colour.GsaDarkBlue)
                {
                    Width = 0.5f
                };
                Font  font       = new Font(GH_FontServer.FamilyStandard, 7);
                Brush fontColour = UI.Colour.AnnotationTextDark;
                for (int i = 0; i < dropdownlists.Count; i++)
                {
                    //Draw divider line
                    if (spacerTxts.Count > i)
                    {
                        if (spacerTxts[i] != "")
                        {
                            graphics.DrawString(spacerTxts[i], GH_FontServer.Small, UI.Colour.AnnotationTextDark, SpacerBounds[i], GH_TextRenderingConstants.CenterCenter);
                            graphics.DrawLine(spacer, SpacerBounds[i].X, SpacerBounds[i].Y + SpacerBounds[i].Height / 2, SpacerBounds[i].X + (SpacerBounds[i].Width - GH_FontServer.StringWidth(spacerTxts[i], GH_FontServer.Small)) / 2 - 4, SpacerBounds[i].Y + SpacerBounds[i].Height / 2);
                            graphics.DrawLine(spacer, SpacerBounds[i].X + (SpacerBounds[i].Width - GH_FontServer.StringWidth(spacerTxts[i], GH_FontServer.Small)) / 2 + GH_FontServer.StringWidth(spacerTxts[i], GH_FontServer.Small) + 4, SpacerBounds[i].Y + SpacerBounds[i].Height / 2, SpacerBounds[i].X + SpacerBounds[i].Width, SpacerBounds[i].Y + SpacerBounds[i].Height / 2);
                        }
                    }

                    // Draw selected item
                    // set font and colour depending on inital or selected text
                    font       = new Font(GH_FontServer.FamilyStandard, 7);
                    fontColour = UI.Colour.AnnotationTextDark;
                    if (initialTxts != null)
                    {
                        if (displayTexts[i] == initialTxts[i])
                        {
                            pen        = new Pen(UI.Colour.BorderColour);
                            font       = GH_FontServer.Small;
                            fontColour = Brushes.Gray;
                        }
                    }

                    // background
                    Brush background = new SolidBrush(UI.Colour.GsaLightGrey);
                    graphics.FillRectangle(background, BorderBound[i]); // background
                                                                        // border
                    graphics.DrawRectangle(pen, BorderBound[i].X, BorderBound[i].Y, BorderBound[i].Width, BorderBound[i].Height);
                    // text
                    graphics.DrawString(displayTexts[i], font, fontColour, TextBound[i], GH_TextRenderingConstants.NearCenter);
                    // draw dropdown arrow460a2412-ce15-49a6-b8da-e512ba92eeec
                    ButtonsUI.DropDownArrow.DrawDropDownButton(graphics, new PointF(ButtonBound[i].X + ButtonBound[i].Width / 2, ButtonBound[i].Y + ButtonBound[i].Height / 2), UI.Colour.GsaDarkBlue, 15);

                    // draw dropdown list
                    font       = new Font(GH_FontServer.FamilyStandard, 7);
                    fontColour = UI.Colour.AnnotationTextDark;
                    if (unfolded[i])
                    {
                        Pen   penborder          = new Pen(Brushes.Gray);
                        Brush dropdownbackground = new SolidBrush(UI.Colour.GsaLightGrey);
                        penborder.Width = 0.3f;
                        for (int j = 0; j < dropdownBounds[i].Count; j++)
                        {
                            // background
                            graphics.FillRectangle(dropdownbackground, dropdownBounds[i][j]);
                            // border
                            graphics.DrawRectangle(penborder, dropdownBounds[i][j].X, dropdownBounds[i][j].Y, dropdownBounds[i][j].Width, dropdownBounds[i][j].Height);
                            // text
                            graphics.DrawString(dropdownlists[i][j], font, fontColour, dropdownBounds[i][j], GH_TextRenderingConstants.NearCenter);
                        }
                        // border
                        graphics.DrawRectangle(pen, dropdownBound[i].X, dropdownBound[i].Y, dropdownBound[i].Width, dropdownBound[i].Height);
                    }
                }

                // #### check boxes ####
                // add additional check boxes if first dropdown is selected to be standard

                if (displayTexts[0] == "Standard")
                {
                    //Draw divider line
                    string spacertext = "Settings";
                    {
                        graphics.DrawString(spacertext, GH_FontServer.Small, UI.Colour.AnnotationTextDark, addispacer, GH_TextRenderingConstants.CenterCenter);
                        graphics.DrawLine(spacer, addispacer.X, addispacer.Y + addispacer.Height / 2, addispacer.X + (addispacer.Width - GH_FontServer.StringWidth(spacertext, GH_FontServer.Small)) / 2 - 4, addispacer.Y + addispacer.Height / 2);
                        graphics.DrawLine(spacer, addispacer.X + (addispacer.Width - GH_FontServer.StringWidth(spacertext, GH_FontServer.Small)) / 2 + GH_FontServer.StringWidth(spacertext, GH_FontServer.Small) + 4, addispacer.Y + addispacer.Height / 2, addispacer.X + addispacer.Width, addispacer.Y + addispacer.Height / 2);
                    }

                    Color myColour         = UI.Colour.GsaDarkBlue;
                    Brush myBrush          = new SolidBrush(myColour);
                    Brush activeFillBrush  = myBrush;
                    Brush passiveFillBrush = Brushes.LightGray;
                    Color borderColour     = myColour;
                    Color passiveBorder    = Color.DarkGray;
                    int   s = 8;

                    // select case for what to display
                    switch (displayTexts[1])
                    {
                    case "Rectangle":
                        graphics.DrawString("Taper", font, fontColour, taperTxtBounds, GH_TextRenderingConstants.NearCenter);
                        ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(taperBounds.X + taperBounds.Width / 2, taperBounds.Y + taperBounds.Height / 2), isTapered, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                        if (!isTapered)
                        {
                            graphics.DrawString("Hollow", font, fontColour, hollowTxtBounds, GH_TextRenderingConstants.NearCenter);
                            ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(hollowBounds.X + hollowBounds.Width / 2, hollowBounds.Y + hollowBounds.Height / 2), isHollow, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);
                        }

                        break;

                    case "Circle":
                        graphics.DrawString("Hollow", font, fontColour, hollowTxtBounds, GH_TextRenderingConstants.NearCenter);
                        ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(hollowBounds.X + hollowBounds.Width / 2, hollowBounds.Y + hollowBounds.Height / 2), isHollow, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                        graphics.DrawString("Elliptical", font, fontColour, ellipTxtBounds, GH_TextRenderingConstants.NearCenter);
                        ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(ellipBounds.X + ellipBounds.Width / 2, ellipBounds.Y + ellipBounds.Height / 2), isElliptical, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                        break;

                    case "I section":
                        graphics.DrawString("General", font, fontColour, genTxtBounds, GH_TextRenderingConstants.NearCenter);
                        ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(genBounds.X + genBounds.Width / 2, genBounds.Y + genBounds.Height / 2), isGeneral, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                        if (isGeneral)
                        {
                            graphics.DrawString("Taper", font, fontColour, taperTxtBounds, GH_TextRenderingConstants.NearCenter);
                            ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(taperBounds.X + taperBounds.Width / 2, taperBounds.Y + taperBounds.Height / 2), isTapered, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);
                        }

                        break;

                    case "Tee":
                        graphics.DrawString("Taper", font, fontColour, taperTxtBounds, GH_TextRenderingConstants.NearCenter);
                        ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(taperBounds.X + taperBounds.Width / 2, taperBounds.Y + taperBounds.Height / 2), isTapered, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                        break;

                    case "Channel":
                        graphics.DrawString("Back to Back", font, fontColour, b2bTxtBounds, GH_TextRenderingConstants.NearCenter);
                        ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(b2bBounds.X + b2bBounds.Width / 2, b2bBounds.Y + b2bBounds.Height / 2), isB2B, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                        break;

                    case "Angle":
                        graphics.DrawString("Back to Back", font, fontColour, b2bTxtBounds, GH_TextRenderingConstants.NearCenter);
                        ButtonsUI.CheckBox.DrawCheckButton(graphics, new PointF(b2bBounds.X + b2bBounds.Width / 2, b2bBounds.Y + b2bBounds.Height / 2), isB2B, activeFillBrush, borderColour, passiveFillBrush, passiveBorder, s);

                        break;
                    }
                }
            }
        }