Class TooltipBuilder
Builder pattern class for constructing formatted tooltip strings. Supports priority-based line ordering, rich text colors, bold, and font sizes. Uses ZString for zero-allocation string building.
public class TooltipBuilder : IDisposable
- Inheritance
-
TooltipBuilder
- Implements
- Inherited Members
Methods
AddLine(string, int, string, bool, string)
Adds a formatted line to the tooltip.
public TooltipBuilder AddLine(string text, int priority = 100, string color = null, bool bold = false, string fontSize = null)
Parameters
textstringThe text content. May contain rich text tags.
priorityintSort priority (lower = earlier). Default is 100.
colorstringColor string: hex with # (e.g., "#f5ad6eFF") or named (e.g., "white"). Null for no color.
boldboolWhether to render in bold.
fontSizestringFont size string (e.g., "120%", "14"). Null for default size.
Returns
- TooltipBuilder
This builder for fluent chaining.
AddSeparator(int)
Adds a separator line to the tooltip.
public TooltipBuilder AddSeparator(int priority = 50)
Parameters
priorityintSort priority for the separator.
Returns
- TooltipBuilder
This builder for fluent chaining.
Build()
Sorts all lines by priority and builds the final formatted rich text string.
public string Build()
Returns
- string
The complete tooltip string with rich text formatting.
Clear()
Clears all lines from the builder for reuse.
public void Clear()
Dispose()
Disposes the builder by clearing all lines.
public void Dispose()