protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); HoopoeViewer comp = Owner as HoopoeViewer; if (channel == GH_CanvasChannel.Objects) { GH_Capsule capsule = GH_Capsule.CreateCapsule(ButtonBounds, GH_Palette.Normal, 0, 0); capsule.Render(graphics, Selected, Owner.Locked, true); capsule.AddOutputGrip(this.OutputGrip.Y); capsule.Dispose(); capsule = null; StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; RectangleF textRectangle = ButtonBounds; graphics.DrawImage(comp.img, Bounds.X + 2, m_innerBounds.Y - (ButtonBounds.Height - Bounds.Height), comp.img.Width - 4, comp.img.Height - 2); format.Dispose(); } }
protected override void Layout() { base.Layout(); HoopoeViewer comp = Owner as HoopoeViewer; int width = comp.img.Width; int height = comp.img.Height; Rectangle rec0 = GH_Convert.ToRectangle(Bounds); int cWidth = rec0.Width; int cHeight = rec0.Height; rec0.Width = width; rec0.Height += height; Rectangle rec1 = rec0; rec1.Y = rec1.Bottom - height; rec1.Height = height; rec1.Width = width; Bounds = rec0; ButtonBounds = rec1; }