/// <summary> /// Returns the size of a string. /// </summary> /// <param name="font"></param> /// <param name="str"></param> /// <returns></returns> public static Size GetSize(Font font, string str) { int width = 0, height = 0; font.ComputeExtent(str, out width, out height); return new Size { Width = width, Height = height }; }
/// <summary> /// Creates a new TextBlock. /// </summary> /// <param name="name">Name</param> /// <param name="alpha">Alpha</param> /// <param name="x">X-axis position.</param> /// <param name="y">Y-axis position.</param> /// <param name="width">Width</param> /// <param name="height">Height</param> public TextBlock(string name, ushort alpha, int x, int y, int width, int height) { Name = name; Alpha = alpha; X = x; Y = y; Width = width; Height = height; // Default Text = string.Empty; TextAlign = HorizontalAlignment.Left; TextVerticalAlign = VerticalAlignment.Top; Font = FontManager.GetFont(FontManager.FontType.droid_reg12); FontColor = Colors.Black; }
/// <summary> /// Returns a Rectangle object the same size of a string. /// </summary> /// <param name="font"></param> /// <param name="str"></param> /// <returns></returns> public static Rectangle GetRect(Font font, string str) { int width = 0, height = 0; font.ComputeExtent(str, out width, out height); return new Rectangle(0, 0, width, height); }
public abstract bool DrawTextInRect(ref string text, ref int xRelStart, ref int yRelStart, int x, int y, int width, int height, uint dtFlags, Color color, Font font);
public void DrawTextInRect(string text, int x, int y, int width, int height, uint dtFlags, Color color, Font font) { int xRelStart = 0; int yRelStart = 0; DrawTextInRect(ref text, ref xRelStart, ref yRelStart, x, y, width, height, dtFlags, color, font); }
public abstract void DrawText(string text, Font font, Color color, int x, int y);
/// <summary> /// Draws text in a rectangle. /// </summary> /// <param name="text">Text</param> /// <param name="rect">Rectangle</param> /// <param name="dtFlags">Flags found in Bitmap.</param> /// <param name="color">Color</param> /// <param name="font">Font</param> public void DrawTextInRect(string text, Rectangle rect, uint dtFlags, Color color, Font font) { _bitmap.DrawTextInRect(text, rect.X, rect.Y, rect.Width, rect.Height, dtFlags, color, font); }
/// <summary> /// Draws text in a rectangle. /// </summary> /// <param name="text">Text</param> /// <param name="xRelStart"></param> /// <param name="yRelStart"></param> /// <param name="x">X</param> /// <param name="y">Y</param> /// <param name="width">Width</param> /// <param name="height">Height</param> /// <param name="dtFlags">Flags found in Bitmap.</param> /// <param name="color">Color</param> /// <param name="font">Font</param> /// <returns></returns> public bool DrawTextInRect(ref string text, ref int xRelStart, ref int yRelStart, int x, int y, int width, int height, uint dtFlags, Color color, Font font) { return _bitmap.DrawTextInRect(ref text, ref xRelStart, ref yRelStart, x, y, width, height, dtFlags, color, font); }
/// <summary> /// Draws text in a rectangle. /// </summary> /// <param name="text">Text</param> /// <param name="x">X</param> /// <param name="y">Y</param> /// <param name="width">Width</param> /// <param name="height">Height</param> /// <param name="dtFlags">Flags found in Bitmap.</param> /// <param name="color">Color</param> /// <param name="font">Font</param> public void DrawTextInRect(string text, int x, int y, int width, int height, uint dtFlags, Color color, Font font) { _bitmap.DrawTextInRect(text, x, y, width, height, dtFlags, color, font); }
/// <summary> /// Draws text. /// </summary> /// <param name="text">Text</param> /// <param name="font">Font</param> /// <param name="color">Color</param> /// <param name="x">X</param> /// <param name="y">Y</param> public void DrawText(string text, Font font, Color color, int x, int y) { _bitmap.DrawText(text, font, color, x, y); }