public override void Render(WidgetRenderArgs args) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown GH_Canvas canvas = args.Canvas; float zoom = canvas.Viewport.Zoom; int num = 255; if (zoom < 1f) { float num2 = (zoom - 0.5f) * 2f; num = (int)((float)num * num2); } if (num < 0) { num = 0; } num = GH_Canvas.ZoomFadeLow; int r = base.Style.Fill.R; int g = base.Style.Fill.G; int b = base.Style.Fill.B; int red = 80; int green = 80; int blue = 80; GH_PaletteStyle val = new GH_PaletteStyle(Color.FromArgb(num, r, g, b), Color.FromArgb(num, red, green, blue)); _menu.Render(canvas.Graphics, val); for (int i = 0; i < _controls.Count; i++) { _controls[i].OnRender(args); } }
protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel) { // Draw base component. base.Render(canvas, graphics, channel); // Add custom elements. if (channel == GH_CanvasChannel.Objects) { // Add button to connect/disconect. GH_Capsule button = GH_Capsule.CreateTextCapsule(this.BoundsButton, this.BoundsButton, GH_Palette.Black, this.component.status ? "Disconnect" : "Connect", 2, 0); button.Render(graphics, this.Selected, this.Owner.Locked, false); button.Dispose(); // Add list of Found Devices. // IPAddress ipv4Addresse = Array.FindLast(Dns.GetHostEntry(string.Empty).AddressList, // a => a.AddressFamily == AddressFamily.InterNetwork); string message = "Devices: "; if (HoloConnect.deviceFinder.devices.Count > 0) { foreach (HoloDevice device in HoloConnect.deviceFinder.devices.Values) { message += "\n" + device.ToString(); } } else { message += "(not found)"; } graphics.DrawString(message, GH_FontServer.NewFont(FontFamily.GenericMonospace, 6, FontStyle.Regular), Brushes.Black, this.BoundsText, GH_TextRenderingConstants.CenterCenter); } }
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); } } }
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); } } }
protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel == GH_CanvasChannel.Objects) { /* //okay, so let's render the background * RectangleF capsuleBox = new RectangleF(this.Bounds.Location, this.Bounds.Size); * GH_Capsule capsule = GH_Capsule.CreateCapsule(capsuleBox, GH_Palette.Normal); * // but when we have a warning, change colors appropriately * if (Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Error || * Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Warning) * { * capsule.Render(graphics, this.Selected, Owner.Locked, true); * } * else * { * capsule.Render(graphics, Color.FromArgb(188, 157, 202)); * } * capsule.Dispose(); */ button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, GH_Palette.Pink, "(Re)load Cluster", 2, 0); button.Render(graphics, Selected, Owner.Locked, false); button.Dispose(); } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel == GH_CanvasChannel.Objects) { GH_Capsule button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, xColor, "X", 3, 0); button.Render(graphics, Selected, false, false); button.Dispose(); } if (channel == GH_CanvasChannel.Objects) { GH_Capsule button2 = GH_Capsule.CreateTextCapsule(ButtonBounds2, ButtonBounds2, yColor, "Y", 2, 0); button2.Render(graphics, Selected, Owner.Locked, false); button2.Dispose(); } if (channel == GH_CanvasChannel.Objects) { GH_Capsule button3 = GH_Capsule.CreateTextCapsule(ButtonBounds3, ButtonBounds3, zColor, "Z", 2, 0); button3.Render(graphics, Selected, Owner.Locked, false); button3.Dispose(); } if (channel == GH_CanvasChannel.Objects) { GH_Capsule button4 = GH_Capsule.CreateTextCapsule(ButtonBounds4, ButtonBounds4, rxColor, "Fix Rotation", 2, 0); button4.Render(graphics, Selected, Owner.Locked, false); button4.Dispose(); } }
protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel) { switch (channel) { case GH_CanvasChannel.Objects: base.RenderComponentCapsule(canvas, graphics, true, false, false, true, true, true); ComponentWithDirectionLogic comp = Owner as ComponentWithDirectionLogic; GH_Capsule btnX = GH_Capsule.CreateCapsule(DirectionX, comp.Direction == FaceDirection.X ? GH_Palette.Black : GH_Palette.White); btnX.Render(graphics, this.Selected, Owner.Locked, Owner.Hidden); btnX.Dispose(); GH_Capsule btnY = GH_Capsule.CreateCapsule(DirectionY, comp.Direction == FaceDirection.Y ? GH_Palette.Black : GH_Palette.White); btnY.Render(graphics, this.Selected, Owner.Locked, Owner.Hidden); btnY.Dispose(); GH_Capsule btnZ = GH_Capsule.CreateCapsule(DirectionZ, comp.Direction == FaceDirection.Z ? GH_Palette.Black : GH_Palette.White); btnZ.Render(graphics, this.Selected, Owner.Locked, Owner.Hidden); btnZ.Dispose(); graphics.DrawString("X", GH_FontServer.Standard, comp.Direction == FaceDirection.X ? Brushes.Gold : Brushes.Black, DirectionX, GH_TextRenderingConstants.CenterCenter); graphics.DrawString("Y", GH_FontServer.Standard, comp.Direction == FaceDirection.Y ? Brushes.Gold : Brushes.Black, DirectionY, GH_TextRenderingConstants.CenterCenter); graphics.DrawString("Z", GH_FontServer.Standard, comp.Direction == FaceDirection.Z ? Brushes.Gold : Brushes.Black, DirectionZ, GH_TextRenderingConstants.CenterCenter); break; default: base.Render(canvas, graphics, channel); break; } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { if (channel == GH_CanvasChannel.Objects) { GH_CapsuleRenderEngine.RenderOutputGrip(graphics, canvas.Viewport.Zoom, OutputGrip, true); for (int col = 0; col < 3; col++) { for (int row = 0; row < 3; row++) { int value = Value(col, row); Rectangle button = Button(col, row); GH_Palette palette = GH_Palette.White; if (value == Owner.Value) { palette = GH_Palette.Blue; } GH_Capsule capsule = GH_Capsule.CreateTextCapsule(button, button, palette, value.ToString(), 0, 0); capsule.Render(graphics, Selected, Owner.Locked, true); capsule.Dispose(); } } } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel == GH_CanvasChannel.Objects) { StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; format.Trimming = StringTrimming.EllipsisCharacter; GH_Capsule radio = GH_Capsule.CreateCapsule(radio_rec, GH_Palette.White, 2, 0); radio.Render(graphics, Selected, Owner.Locked, false); radio.Dispose(); GH_Capsule radio_1 = GH_Capsule.CreateCapsule(radio_rec_1, GH_Palette.Black, 5, 5); radio_1.Render(graphics, Selected, Owner.Locked, false); radio_1.Dispose(); graphics.FillEllipse(c1, radio_rec_1); graphics.DrawString("X", GH_FontServer.Standard, Brushes.Black, text_rec_1); GH_Capsule radio_2 = GH_Capsule.CreateCapsule(radio_rec_2, GH_Palette.Black, 5, 5); radio_2.Render(graphics, Selected, Owner.Locked, false); radio_2.Dispose(); graphics.FillEllipse(c2, radio_rec_2); graphics.DrawString("Y", GH_FontServer.Standard, Brushes.Black, text_rec_2); GH_Capsule radio_3 = GH_Capsule.CreateCapsule(radio_rec_3, GH_Palette.Black, 5, 5); radio_3.Render(graphics, Selected, Owner.Locked, false); radio_3.Dispose(); graphics.FillEllipse(c3, radio_rec_3); graphics.DrawString("Z", GH_FontServer.Standard, Brushes.Black, text_rec_3); } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { switch (channel) { case GH_CanvasChannel.Wires: graphics.FillEllipse(Brushes.HotPink, Bounds); foreach (IModifiable mod in Owner.TargetObjects()) { if (mod == null) { continue; } IGH_DocumentObject obj = mod as IGH_DocumentObject; if (obj == null) { continue; } DrawTargetArrow(graphics, obj.Attributes.Bounds); } break; case GH_CanvasChannel.Objects: GH_Capsule capsule = GH_Capsule.CreateCapsule(InnerBounds, GH_Palette.Normal, InnerRadius, 0); capsule.Render(graphics, Selected, Owner.Locked, true); capsule.Dispose(); string text = string.Format("{0:0.00}", Owner.Factor); Grasshopper.GUI.GH_GraphicsUtil.RenderCenteredText(graphics, text, GH_FontServer.Large, Color.Black, Pivot); break; } }
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(); } }
public static void RenderButtonIcon_Obsolete(Graphics graphics, GH_Component Owner, RectangleF bound, bool on, Bitmap onMap, Bitmap offMap, int cornerRadius = 6, GH_Palette normalPalette = GH_Palette.Normal) { GH_Palette palette = Owner.RuntimeMessages(GH_RuntimeMessageLevel.Error).Count > 0 ? GH_Palette.Error : Owner.RuntimeMessages(GH_RuntimeMessageLevel.Warning).Count > 0 ? GH_Palette.Warning : normalPalette; GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(palette, Owner.Attributes.Selected, Owner.Locked, Owner.Hidden); GH_Capsule cap = GH_Capsule.CreateCapsule(bound, palette, cornerRadius, 0); cap.Render(graphics, on ? onMap : offMap, impliedStyle); }
private static void doCapsule(Graphics g, RectangleF bounds, GH_Palette palette, Color color) { GH_Capsule capsule = GH_Capsule.CreateCapsule(bounds, palette, 3, 6); capsule.Render(g, color); capsule.Dispose(); capsule = null; }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel == GH_CanvasChannel.Objects) { StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; format.Trimming = StringTrimming.EllipsisCharacter; GH_Capsule radio = GH_Capsule.CreateCapsule(radio_rec, GH_Palette.White, 2, 0); radio.Render(graphics, Selected, Owner.Locked, false); radio.Dispose(); GH_Capsule radio2 = GH_Capsule.CreateCapsule(radio_rec2, GH_Palette.White, 2, 0); radio2.Render(graphics, Selected, Owner.Locked, false); radio2.Dispose(); GH_Capsule radio_1 = GH_Capsule.CreateCapsule(radio_rec_1, GH_Palette.Black, 5, 5); radio_1.Render(graphics, Selected, Owner.Locked, false); radio_1.Dispose(); graphics.FillEllipse(c1, radio_rec_1); graphics.DrawString("+X", GH_FontServer.Standard, Brushes.Black, text_rec_1); GH_Capsule radio_2 = GH_Capsule.CreateCapsule(radio_rec_2, GH_Palette.Black, 5, 5); radio_2.Render(graphics, Selected, Owner.Locked, false); radio_2.Dispose(); graphics.FillEllipse(c2, radio_rec_2); graphics.DrawString("+Y", GH_FontServer.Standard, Brushes.Black, text_rec_2); GH_Capsule radio_3 = GH_Capsule.CreateCapsule(radio_rec_3, GH_Palette.Black, 5, 5); radio_3.Render(graphics, Selected, Owner.Locked, false); radio_3.Dispose(); graphics.FillEllipse(c3, radio_rec_3); graphics.DrawString("+45", GH_FontServer.Standard, Brushes.Black, text_rec_3); GH_Capsule radio_4 = GH_Capsule.CreateCapsule(radio_rec_4, GH_Palette.Black, 5, 5); radio_4.Render(graphics, Selected, Owner.Locked, false); radio_4.Dispose(); graphics.FillEllipse(c4, radio_rec_4); graphics.DrawString("+135", GH_FontServer.Standard, Brushes.Black, text_rec_4); GH_Capsule radio_5 = GH_Capsule.CreateCapsule(radio_rec_5, GH_Palette.Black, 5, 5); radio_5.Render(graphics, Selected, Owner.Locked, false); radio_5.Dispose(); graphics.FillEllipse(c5, radio_rec_5); graphics.DrawString("-X", GH_FontServer.Standard, Brushes.Black, text_rec_5); GH_Capsule radio_6 = GH_Capsule.CreateCapsule(radio_rec_6, GH_Palette.Black, 5, 5); radio_6.Render(graphics, Selected, Owner.Locked, false); radio_6.Dispose(); graphics.FillEllipse(c6, radio_rec_6); graphics.DrawString("-Y", GH_FontServer.Standard, Brushes.Black, text_rec_6); GH_Capsule radio_7 = GH_Capsule.CreateCapsule(radio_rec_7, GH_Palette.Black, 5, 5); radio_7.Render(graphics, Selected, Owner.Locked, false); radio_7.Dispose(); graphics.FillEllipse(c7, radio_rec_7); graphics.DrawString("-45", GH_FontServer.Standard, Brushes.Black, text_rec_7); GH_Capsule radio_8 = GH_Capsule.CreateCapsule(radio_rec_8, GH_Palette.Black, 5, 5); radio_8.Render(graphics, Selected, Owner.Locked, false); radio_8.Dispose(); graphics.FillEllipse(c8, radio_rec_8); graphics.DrawString("-135", GH_FontServer.Standard, Brushes.Black, text_rec_8); } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { GH_Capsule capsule = GH_Capsule.CreateCapsule(Bounds, GH_Palette.Normal, 100, 0); capsule.AddOutputGrip(OutputGrip.Y); capsule.Render(graphics, Selected, Owner.Locked, true); capsule.Dispose(); capsule = null; }
/// <summary> /// RENDERING LAYOUT /// </summary> /// <param name="canvas"></param> /// <param name="graphics"></param> /// <param name="channel"></param> protected override void Render(Grasshopper.GUI.Canvas.GH_Canvas canvas, System.Drawing.Graphics graphics, Grasshopper.GUI.Canvas.GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel == Grasshopper.GUI.Canvas.GH_CanvasChannel.Objects) { button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, GH_Palette.Transparent, "", new int[] { 0, 0, 0, 5 }, 0); button.Render(graphics, Selected, Owner.Locked, false); button.Render(graphics, Color.FromArgb(255, 50, 100, 150)); button2 = GH_Capsule.CreateTextCapsule(ButtonBounds2, ButtonBounds2, GH_Palette.Transparent, "", new int[] { 0, 0, 5, 0 }, 0); button2.Render(graphics, Selected, Owner.Locked, false); button2.Render(graphics, Color.FromArgb(255, 230, 200, 10)); if (Globals.OpenThisShell[thisIndex2] == true) { System.Drawing.Drawing2D.LinearGradientBrush lgb = new System.Drawing.Drawing2D.LinearGradientBrush( rec0.Location, pythonRect.Location, System.Drawing.Color.FromArgb(255, 0, 200, 0), // Opaque red System.Drawing.Color.FromArgb(255, 0, 200, 0)); // Opaque blue); System.Drawing.Pen p = new System.Drawing.Pen(Color.Black, 1); p.DashCap = System.Drawing.Drawing2D.DashCap.Round; p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; Rectangle r5 = rec0; r5.Inflate(5, 5); // graphics.DrawLine(p, rec0.Location, pythonRect.Location); graphics.DrawPath(p, RoundedRect(r5, 3)); //graphics.DrawRectangle(p, rec0); } StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; format.Trimming = StringTrimming.EllipsisCharacter; Brush gg = new SolidBrush(Color.FromArgb(255, 50, 100, 150)); graphics.DrawString(Owner.NickName, GH_FontServer.Standard, gg, new PointF(rec0.Left, rec0.Bottom + 5)); button.Dispose(); } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel == GH_CanvasChannel.Objects) { StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; format.Trimming = StringTrimming.EllipsisCharacter; GH_Capsule title = GH_Capsule.CreateCapsule(title_rec, GH_Palette.Pink, 2, 0); title.Render(graphics, Selected, Owner.Locked, false); title.Dispose(); RectangleF textRectangle = title_rec; textRectangle.Height = 20; graphics.DrawString("Display Option", GH_FontServer.Standard, Brushes.White, textRectangle, format); GH_Capsule radio = GH_Capsule.CreateCapsule(radio_rec, GH_Palette.White, 2, 0); radio.Render(graphics, Selected, Owner.Locked, false); radio.Dispose(); GH_Capsule radio_11 = GH_Capsule.CreateCapsule(radio_rec_11, GH_Palette.Black, 5, 5); radio_11.Render(graphics, Selected, Owner.Locked, false); radio_11.Dispose(); graphics.FillEllipse(c11, radio_rec_11); graphics.DrawString("BaseShape", GH_FontServer.Standard, Brushes.Black, text_rec_11); GH_Capsule radio_13 = GH_Capsule.CreateCapsule(radio_rec_13, GH_Palette.Black, 5, 5); radio_13.Render(graphics, Selected, Owner.Locked, false); radio_13.Dispose(); graphics.FillEllipse(c13, radio_rec_13); graphics.DrawString("No", GH_FontServer.Standard, Brushes.Black, text_rec_13); GH_Capsule radio_21 = GH_Capsule.CreateCapsule(radio_rec_21, GH_Palette.Black, 5, 5); radio_21.Render(graphics, Selected, Owner.Locked, false); radio_21.Dispose(); graphics.FillEllipse(c21, radio_rec_21); graphics.DrawString("Width", GH_FontServer.Standard, Brushes.Black, text_rec_21); GH_Capsule radio_22 = GH_Capsule.CreateCapsule(radio_rec_22, GH_Palette.Black, 5, 5); radio_22.Render(graphics, Selected, Owner.Locked, false); radio_22.Dispose(); graphics.FillEllipse(c22, radio_rec_22); graphics.DrawString("Thick", GH_FontServer.Standard, Brushes.Black, text_rec_22); GH_Capsule radio_23 = GH_Capsule.CreateCapsule(radio_rec_23, GH_Palette.Black, 5, 5); radio_23.Render(graphics, Selected, Owner.Locked, false); radio_23.Dispose(); graphics.FillEllipse(c23, radio_rec_23); graphics.DrawString("N/A", GH_FontServer.Standard, Brushes.Black, text_rec_23); GH_Capsule radio2 = GH_Capsule.CreateCapsule(radio_rec2, GH_Palette.White, 2, 0); radio2.Render(graphics, Selected, Owner.Locked, false); radio2.Dispose(); GH_Capsule radio2_1 = GH_Capsule.CreateCapsule(radio_rec2_1, GH_Palette.Black, 5, 5); radio2_1.Render(graphics, Selected, Owner.Locked, false); radio2_1.Dispose(); graphics.FillEllipse(c2, radio_rec2_1); graphics.DrawString("PDF OUTPUT", GH_FontServer.Standard, Brushes.Black, text_rec2_1); ///****************************************************************************************** } }
protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel == GH_CanvasChannel.Objects) { GH_Capsule button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, GH_Palette.Black, "Generate!", 2, 0); button.Render(graphics, Selected, Owner.Locked, false); button.Dispose(); } }
public static void RenderButtonText_Obsolete(Graphics graphics, GH_Component Owner, RectangleF bound, bool on, string text, Color onColor, Color offColor, Font font, int cornerRadius = 6, GH_Palette normalPalette = GH_Palette.Normal) { GH_Palette palette = Owner.RuntimeMessages(GH_RuntimeMessageLevel.Error).Count > 0 ? GH_Palette.Error : Owner.RuntimeMessages(GH_RuntimeMessageLevel.Warning).Count > 0 ? GH_Palette.Warning : normalPalette; GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(palette, Owner.Attributes.Selected, Owner.Locked, Owner.Hidden); GH_Capsule cap = GH_Capsule.CreateCapsule(bound, palette, cornerRadius, 0); cap.Render(graphics, impliedStyle); Brush brush = new SolidBrush(on ? onColor : offColor); graphics.DrawString(text, font, brush, bound); }
public static void HighLightCom(Graphics graphics, GH_Component com, int rowsCount) { Rectangle relayrect = GH_Convert.ToRectangle(com.Attributes.Bounds); relayrect.Inflate(ShareData.FrameWidthGraph, ShareData.FrameWidthGraph); Rectangle rect = new Rectangle(relayrect.X, relayrect.Y, relayrect.Width, relayrect.Height + rowsCount * 15); GH_Capsule gH_Capsule = GH_Capsule.CreateCapsule(rect, GH_Palette.Pink, ShareData.FrameWidth, 5); gH_Capsule.Render(graphics, ShareData.ThemeColor); gH_Capsule.Dispose(); }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { //flag = Math.Pow(this.Bounds.X + this.Bounds.Width / 2, 2) + Math.Pow(this.Bounds.Y + this.Bounds.Height / 2, 2) > Math.Pow(3, 2); if (channel == GH_CanvasChannel.Groups && IsNotFirstRender) { GH_Capsule gH_Capsule = GH_Capsule.CreateCapsule(this.Bounds, GH_Palette.Pink, this.Radius, 0); gH_Capsule.Render(graphics, this.Color); gH_Capsule.Dispose(); } IsNotFirstRender = true; }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); Print comp = Owner as Print; if (channel == GH_CanvasChannel.Objects) { GH_Capsule button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, comp.toggle ? GH_Palette.Grey : GH_Palette.Black, "Print", 2, 0); button.Render(graphics, Selected, Owner.Locked, false); button.Dispose(); } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); var demBounds = (RectangleF) GH_Convert.ToRectangle(new RectangleF(new PointF(this.Pivot.X + 60, this.Pivot.Y), (SizeF) new Size(W - 60 - 80, H))); GH_Palette palette = GH_Palette.White; GH_Capsule capsule = GH_Capsule.CreateCapsule(demBounds, palette); capsule.Render(graphics, Selected, Owner.Locked, true); capsule.Dispose(); capsule = null; StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Near; format.LineAlignment = StringAlignment.Center; format.Trimming = StringTrimming.EllipsisCharacter; // Content rectangle RectangleF textRectangle = demBounds; textRectangle.Height = 20; for (int i = 0; i < BimVisualiserData.Instance.NameList.Count; i++) { _boundingBoxes.Insert(i, textRectangle); // Max entries value (it would be nice extending the Bounds if more) if (i == 25) { break; } if (i == BimVisualiserData.Instance.Selected) { graphics.DrawString(BimVisualiserData.Instance.NameList[i], GH_FontServer.Standard, Brushes.DodgerBlue, textRectangle, format); } else { graphics.DrawString(BimVisualiserData.Instance.NameList[i], GH_FontServer.Standard, Brushes.Black, textRectangle, format); } format.Alignment = StringAlignment.Near; //textRectangle.Inflate(-5, 0); textRectangle.Y += 20; } // Always dispose of any GDI+ object that implement IDisposable. format.Dispose(); }
public static void ButtonIconRender(Graphics graphics, GH_CanvasChannel channel, IButtonIcon button) { if (channel == GH_CanvasChannel.Objects) { graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; GH_Palette palette = button.RenderSet.normalPalette; GH_PaletteStyle impliedStyle = GetPaletteStype(button, out palette); GH_Capsule cap = GH_Capsule.CreateCapsule(button.Bounds, palette, button.RenderSet.CornerRadius, button.RenderSet.HighLight); cap.Render(graphics, button.Icon, impliedStyle); } }
protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); SlimeComponent comp = Owner as SlimeComponent; if (channel == GH_CanvasChannel.Objects) { GH_Capsule button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, comp.Run == true ? GH_Palette.Grey : GH_Palette.Transparent, "RESET", 2, 0); button.Render(graphics, Selected, Owner.Locked, false); button.Dispose(); } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { //Bounds = new RectangleF(Pivot.X - OuterComponentRadius, Pivot.Y - OuterComponentRadius, 2 * OuterComponentRadius, 2 * OuterComponentRadius); // Bounds = InnerComponentBounds; // base.Render(canvas, graphics, channel); if (Owner is HouseInstance houseInstance) { if (channel == GH_CanvasChannel.Objects) { graphics.FillRectangle(houseBrush, OuterComponentBounds); base.Render(canvas, graphics, channel); // Bounds = InnerComponentBounds; // GH_Capsule.CreateCapsule(Bounds, GH_Palette.Grey).Render(graphics, Color.Gray); // Bounds = new RectangleF(Pivot.X - OuterComponentRadius, Pivot.Y - 2 * OuterComponentRadius, 2 * OuterComponentRadius, OuterComponentRadius); // Layout(); // GH_ComponentAttributes.RenderComponentParameters(canvas, graphics, Owner, new GH_PaletteStyle(Color.Brown)); // Bounds = new RectangleF(Pivot.X - OuterComponentRadius, Pivot.Y - OuterComponentRadius, 2 * OuterComponentRadius, 2 * OuterComponentRadius); // foreach (IGH_DocumentObject obj in roomInstancesList) // DrawTargetArrow(graphics, obj.Attributes.Bounds); // GH_Capsule capsule = GH_Capsule.CreateCapsule(InnerComponentBounds, GH_Palette.Normal, InnerComponentRadius, 0); // capsule.Render(graphics, Selected, Owner.Locked, true); // capsule.Dispose(); graphics.DrawString("A:", SystemFonts.IconTitleFont, Brushes.Black, new RectangleF(new System.Drawing.Point((int)Bounds.Location.X + 30, (int)Bounds.Location.Y + 77), new Size(20, 20))); HouseName = GH_Capsule.CreateTextCapsule(HouseNameRectangle, InflateRect(HouseNameRectangle, InflateAmount, InflateAmount), GH_Palette.Pink, houseInstance.HouseName); HouseName.Render(graphics, GH_Skin.palette_grey_standard); HouseName.Dispose(); FloorName = GH_Capsule.CreateTextCapsule(FloorNameRectangle, InflateRect(FloorNameRectangle, InflateAmount, InflateAmount), GH_Palette.Pink, houseInstance.FloorName.ToString()); FloorName.Render(graphics, GH_Skin.palette_white_standard); FloorName.Dispose(); } else { // foreach (IGH_DocumentObject obj in roomInstancesList) // DrawTargetArrow(graphics, obj.Attributes.Bounds); base.Render(canvas, graphics, channel); } } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { if ((int)channel == 10) { foreach (IGH_Param item in Owner.Params.Input) { item.Attributes.RenderToCanvas(canvas, (GH_CanvasChannel)10); } } else { if ((int)channel != 20) { return; } RectangleF bounds = base.Bounds; bool flag = canvas.Viewport.IsVisible(ref bounds, 10f); Bounds = bounds; if (flag) { GH_Palette impliedPalette = GH_CapsuleRenderEngine.GetImpliedPalette((IGH_ActiveObject)(object)base.Owner); GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(impliedPalette, Selected, Owner.Locked, Owner.Hidden); GH_Capsule val = GH_Capsule.CreateCapsule(base.Bounds, impliedPalette, 5, 30); foreach (IGH_Param item2 in Owner.Params.Input) { val.AddInputGrip(item2.Attributes.InputGrip.Y); } val.AddOutputGrip(OutputGrip.Y); if (Owner.Message != null) { val.RenderEngine.RenderMessage(graphics, Owner.Message, impliedStyle); } val.Render(graphics, Selected, Owner.Locked, true); val.Dispose(); GH_ComponentAttributes.RenderComponentParameters(canvas, graphics, base.Owner, impliedStyle); if (base.Owner.Graph == null) { RectangleF bounds2 = base.Bounds; bounds2.X += inputWidth; bounds2.Width -= inputWidth + outputWidth; bounds2.Inflate(-6f, -6f); GH_GraphContainer.Render_GraphBackground(graphics, bounds2, false); } else { base.Owner.Container.Render(graphics, DrawDomainsTags, base.Owner.Samples); } } } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { switch (channel) { case GH_CanvasChannel.Wires: graphics.FillEllipse(Brushes.Bisque, Bounds); foreach (IModifiable mod in Owner.TargetObjects()) { if (mod == null) { continue; } IGH_DocumentObject obj = mod as IGH_DocumentObject; if (obj == null) { continue; } DrawTargetArrow(graphics, obj.Attributes.Bounds); } break; case GH_CanvasChannel.Objects: GH_Capsule capsule = GH_Capsule.CreateCapsule(InnerBounds, GH_Palette.Normal, InnerRadius, 0); capsule.Render(graphics, Selected, Owner.Locked, true); capsule.Dispose(); string text = string.Format("{0:0.00}", "F**K YOURSELF"); Grasshopper.GUI.GH_GraphicsUtil.RenderCenteredText(graphics, text, GH_FontServer.Large, Color.Black, Pivot); //Grasshopper.GUI.GH_GraphicsUtil.RenderObjectOverlay(graphics, , Bounds); //GH_Capsule.CreateTextCapsule RectangleF capsuleRect = new RectangleF( new PointF(InnerBounds.Location.X + 50, InnerBounds.Location.Y + 50), new SizeF(30, 30)); GH_Capsule capsuleBlue = GH_Capsule.CreateCapsule(capsuleRect, GH_Palette.Blue); capsuleBlue.Render(graphics, Selected, Owner.Locked, true); capsuleBlue.Dispose(); /* var field = new NumberInputTextField(new Param_Number()) * { * Bounds = GH_Convert.ToRectangle(Bounds) * }; * var matrix = sender.Viewport.XFormMatrix(GH_Viewport.GH_DisplayMatrix.CanvasToControl); * * field.ShowTextInputBox(sender, initial, true, true, matrix); */ break; } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel == GH_CanvasChannel.Objects) { GH_Capsule radio1 = GH_Capsule.CreateCapsule(radio_rec1, GH_Palette.White, 2, 0); radio1.Render(graphics, Selected, Owner.Locked, false); radio1.Dispose(); GH_Capsule radio1_1 = GH_Capsule.CreateCapsule(radio_rec1_1, GH_Palette.Black, 5, 5); radio1_1.Render(graphics, Selected, Owner.Locked, false); radio1_1.Dispose(); graphics.FillEllipse(c1, radio_rec1_1); graphics.DrawString("Bake", GH_FontServer.Standard, Brushes.Black, text_rec1_1); } }
internal override void Render(Graphics graphics, PointF cursorCanvasPosition, bool selected, bool locked, bool hidden) { //RectangleF rec = new RectangleF(Bounds.X + Offset / 3f, Bounds.Y + Offset / 3f, Bounds.Width - 2 * Offset / 3f, Bounds.Height - 2 * Offset / 3f); if (IsSelected) { GH_Capsule capsule = GH_Capsule.CreateCapsule(Bounds, GH_Palette.Transparent, 2, 0); capsule.Render(graphics, (Enabled && !locked)? new GH_PaletteStyle(Color.AntiqueWhite, Color.SlateGray) : new GH_PaletteStyle(Color.Transparent, Color.SlateGray) ); capsule.Dispose(); //graphics.DrawRectangle(new Pen(Brushes.Black,2.5f), Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height); } else if (Bounds.Contains(cursorCanvasPosition) && Enabled) { GH_Capsule capsule = GH_Capsule.CreateCapsule(Bounds, GH_Palette.Transparent, 2, 0); capsule.Render(graphics, new GH_PaletteStyle(Color.Transparent)); capsule.Dispose(); } //graphics.DrawRectangle(new Pen(Brushes.Black), Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height); if (ShowTitle) { if (_image != null) { graphics.DrawImage(_image, Bounds.X + Offset / 3.0f, Bounds.Y + Offset / 3.0f); graphics.DrawString(Name, SmallFont, this.ActiveBrush(), _image.Width + Bounds.X + 2 * Offset / 3.0f, Bounds.Y + Offset / 3.0f, _format); } else { graphics.DrawString(Name, SmallFont, this.ActiveBrush(), Bounds.X + 2 * Offset / 3.0f, Bounds.Y + Offset / 3.0f, _format); } } else { if (_image != null) { graphics.DrawImage(_image, Bounds.X + Bounds.Width / 2f - _image.Width / 2f, Bounds.Y + Offset / 3.0f); } else { graphics.DrawString(Name, SmallFont, this.ActiveBrush(), Bounds.X + 2 * Offset / 3.0f, Bounds.Y + Offset / 3.0f, _format); } } }
protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel == GH_CanvasChannel.Objects) { /* //okay, so let's render the background RectangleF capsuleBox = new RectangleF(this.Bounds.Location, this.Bounds.Size); GH_Capsule capsule = GH_Capsule.CreateCapsule(capsuleBox, GH_Palette.Normal); // but when we have a warning, change colors appropriately if (Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Error || Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Warning) { capsule.Render(graphics, this.Selected, Owner.Locked, true); } else { capsule.Render(graphics, Color.FromArgb(188, 157, 202)); } capsule.Dispose(); */ button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, GH_Palette.Pink, "(Re)load Cluster", 2, 0); button.Render(graphics, Selected, Owner.Locked, false); button.Dispose(); } }