Click or drag to resize

GH_GraphicsUtilRenderTag Method

Render a text tag into a Graphics surface.

Namespace:  Grasshopper.GUI
Assembly:  Grasshopper (in Grasshopper.dll)
Syntax
public static void RenderTag(
	Graphics g,
	string tag,
	Font font,
	Color backColor,
	Color foreColor,
	RectangleF frame,
	StringAlignment alignH,
	StringAlignment alignV
)

Parameters

g
Type: System.DrawingGraphics
Graphics object to draw with.
tag
Type: SystemString
Text to draw.
font
Type: System.DrawingFont
Font to use.
backColor
Type: System.DrawingColor
Tag background colour.
foreColor
Type: System.DrawingColor
Tag foreground colour.
frame
Type: System.DrawingRectangleF
The frame into which the tags should be aligned.
alignH
Type: System.DrawingStringAlignment
Horizontal alignment.
alignV
Type: System.DrawingStringAlignment
Vertical alignment.
Examples
This example shows how to render the 8 corner and edge tags into a rectangle:
VB
Function RenderCornerAndEdgeTags(ByVal G As Graphics, ByVal frame As RectangleF)
  Dim font As New Font("Courier New", 8)
  Dim bg As Color = Color.White
  Dim fg As Color = Color.Black

  'Render the 4 corner tags
  RenderTag(G, "UL", font, bg, fg, frame, StringAlignment.Near, StringAlignment.Near)
  RenderTag(G, "UR", font, bg, fg, frame, StringAlignment.Far, StringAlignment.Near)
  RenderTag(G, "LR", font, bg, fg, frame, StringAlignment.Far, StringAlignment.Far)
  RenderTag(G, "LL", font, bg, fg, frame, StringAlignment.Near, StringAlignment.Far)

  'Render the 4 edge tags
  RenderTag(G, "T", font, bg, fg, frame, StringAlignment.Center, StringAlignment.Near)
  RenderTag(G, "R", font, bg, fg, frame, StringAlignment.Far, StringAlignment.Center)
  RenderTag(G, "B", font, bg, fg, frame, StringAlignment.Center, StringAlignment.Far)
  RenderTag(G, "L", font, bg, fg, frame, StringAlignment.Near, StringAlignment.Center)
End Function
See Also