Exemplo n.º 1
0
 /// <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 };
 }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
 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);
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public abstract void DrawText(string text, Font font, Color color, int x, int y);
Exemplo n.º 7
0
 /// <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);
 }
Exemplo n.º 8
0
 /// <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);
 }
Exemplo n.º 9
0
 /// <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);
 }
Exemplo n.º 10
0
 /// <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);
 }