Exemplo n.º 1
0
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Objects)
            {
                GH_Capsule capsule = GH_Capsule.CreateCapsule(this.Bounds, GH_Palette.Normal);
                capsule.AddOutputGrip(this.OutputGrip.Y);
                capsule.Render(canvas.Graphics, this.Selected, this.Owner.Locked, this.Owner.Hidden);
                capsule.Dispose();
                int zoomFadeLow = GH_Canvas.ZoomFadeLow;
                if (zoomFadeLow > 0)
                {
                    canvas.SetSmartTextRenderingHint();
                    GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(GH_Palette.Normal, this);
                    Color           color        = Color.FromArgb(zoomFadeLow, impliedStyle.Text);

                    if (this.NameBounds.Width > 0f)
                    {
                        SolidBrush brush = new SolidBrush(color);
                        graphics.DrawString(this.ownerOfThisAttribute.NickName, GH_FontServer.Standard, brush, this.NameBounds, GH_TextRenderingConstants.CenterCenter);
                        brush.Dispose();
                        int x    = Convert.ToInt32(this.NameBounds.Right);
                        int num3 = Convert.ToInt32(this.NameBounds.Top);
                        int num4 = Convert.ToInt32(this.NameBounds.Bottom);
                        GH_GraphicsUtil.EtchFadingVertical(graphics, num3, num4, x, Convert.ToInt32((double)(0.8 * zoomFadeLow)), Convert.ToInt32((double)(0.3 * zoomFadeLow)));
                    }

                    this.RenderDropDown(canvas, graphics, color);
                }
            }
        }
Exemplo n.º 2
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Objects)
            {
                GH_Capsule capsule = GH_Capsule.CreateCapsule(this.Bounds, GH_Palette.Normal);
                capsule.AddOutputGrip(this.OutputGrip.Y);
                capsule.Render(canvas.Graphics, this.Selected, this.Owner.Locked, this.Owner.Hidden);
                capsule.Dispose();
                int alpha = GH_Canvas.ZoomFadeLow;
                if (alpha > 0)
                {
                    canvas.SetSmartTextRenderingHint();
                    GH_PaletteStyle      style = GH_CapsuleRenderEngine.GetImpliedStyle(GH_Palette.Normal, this);
                    System.Drawing.Color color = System.Drawing.Color.FromArgb(alpha, style.Text);
                    if (this.NameBounds.Width > 0f)
                    {
                        System.Drawing.SolidBrush nameFill = new System.Drawing.SolidBrush(color);
                        graphics.DrawString(this.Owner.NickName, GH_FontServer.Standard, nameFill, this.NameBounds, GH_TextRenderingConstants.CenterCenter);
                        nameFill.Dispose();
                        int x  = System.Convert.ToInt32(this.NameBounds.Right);
                        int y0 = System.Convert.ToInt32(this.NameBounds.Top);
                        int y  = System.Convert.ToInt32(this.NameBounds.Bottom);
                        GH_GraphicsUtil.EtchFadingVertical(graphics, y0, y, x, System.Convert.ToInt32(0.8 * (double)alpha), System.Convert.ToInt32(0.3 * (double)alpha));
                    }

                    // render dropdown only
                    this.RenderDropDown(canvas, graphics, color);
                }
            }
        }
Exemplo n.º 3
0
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Wires)
            {
                this.RenderIncomingWires(canvas.Painter, (IEnumerable <IGH_Param>)Owner.Sources, Owner.WireDisplay);
            }
            if (channel != GH_CanvasChannel.Objects)
            {
                return;
            }
            GH_Capsule capsule    = GH_Capsule.CreateCapsule(Bounds, GH_Palette.White);
            GH_Capsule ghCapsule1 = capsule;
            PointF     pointF     = OutputGrip;
            double     y1         = (double)pointF.Y;

            ghCapsule1.AddOutputGrip((float)y1);
            GH_Capsule ghCapsule2 = capsule;

            pointF = InputGrip;
            double y2 = (double)pointF.Y;

            ghCapsule2.AddInputGrip((float)y2);
            capsule.Render(canvas.Graphics, Selected, Owner.Locked, Owner.Hidden);
            capsule.Dispose();
            int zoomFadeLow = GH_Canvas.ZoomFadeLow;

            if (zoomFadeLow > 0)
            {
                canvas.SetSmartTextRenderingHint();
                GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(GH_Palette.White, (IGH_Attributes)this);
                Color           color        = Color.FromArgb(zoomFadeLow, impliedStyle.Text);
                if (NameBounds.Width > 0.0)
                {
                    SolidBrush solidBrush = new SolidBrush(color);
                    graphics.DrawString(Owner.NickName, GH_FontServer.Standard, (Brush)solidBrush, NameBounds, GH_TextRenderingConstants.CenterCenter);
                    solidBrush.Dispose();
                    RectangleF nameBounds = NameBounds;
                    int        int32_1    = Convert.ToInt32(nameBounds.Right);
                    nameBounds = NameBounds;
                    int int32_2 = Convert.ToInt32(nameBounds.Top);
                    nameBounds = NameBounds;
                    int int32_3 = Convert.ToInt32(nameBounds.Bottom);
                    GH_GraphicsUtil.EtchFadingVertical(graphics, int32_2, int32_3, int32_1, Convert.ToInt32(0.8 * (double)zoomFadeLow), Convert.ToInt32(0.3 * (double)zoomFadeLow));
                }
                switch (Owner.ListMode)
                {
                case GH_ValueListMode.CheckList:
                    RenderCheckList(canvas, graphics, color);
                    break;

                case GH_ValueListMode.DropDown:
                    RenderDropDown(canvas, graphics, color);
                    break;

                case GH_ValueListMode.Sequence:
                case GH_ValueListMode.Cycle:
                    RenderSequence(canvas, graphics, color);
                    break;
                }
            }
        }