public UText(String text, UHAlign halign, UVAlign valign, bool isWrapped, float width, float height) { this.text = text; this.valign = valign; this.halign = halign; this.wrapped = isWrapped; this.width = width; this.height = height; _styleRanges.changed += new VoidAction(_styleRanges_collectionChanged); }
float GetShift(float layoutWidth, float textWidth, UHAlign align) { switch (align) { default: case UHAlign.Left: return(0); case UHAlign.Center: return((layoutWidth - textWidth) / 2f); case UHAlign.Right: return(layoutWidth - textWidth); } }
TextAlignment Translate(UHAlign h) { switch (h) { case UHAlign.Left: return(TextAlignment.Leading); case UHAlign.Center: return(TextAlignment.Center); case UHAlign.Right: return(TextAlignment.Trailing); default: return(TextAlignment.Leading); } }
void dtt(float x, float y, UHAlign h, UVAlign v, Color cl, IDraw rt) { tt.halign = h; tt.valign = v; //rt.uDraw.FillRectangle(new Rectangle(x, y, 100, 100), new USolidBrush() { color = cl }); rt.uDraw.DrawText(tt, new Point(x, y), usb, UTextDrawOptions.None, false); }