ConvertSolidColorBrush() public static method

Converts the SolidColorBrush.
public static ConvertSolidColorBrush ( Color color ) : SlimDX.Direct2D.Brush
color System.Drawing.Color The Color.
return SlimDX.Direct2D.Brush
示例#1
0
        /// <summary>
        /// Draws a string.
        /// </summary>
        /// <param name="text">The Text.</param>
        /// <param name="font">The Font.</param>
        /// <param name="rectangle">The Rectangle.</param>
        /// <param name="color">The Color.</param>
        public void DrawString(string text, Font font, Rectangle rectangle, Color color)
        {
            var dxFont = font.Instance as DirectXFont;

            if (dxFont == null)
            {
                throw new ArgumentException("DirectX10 expects a DirectXFont as resource.");
            }

            _renderTarget.DrawText(text, dxFont.GetFont(),
                                   new RectangleF(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height),
                                   DirectXHelper.ConvertSolidColorBrush(color));
        }
示例#2
0
        /// <summary>
        /// Draws a string.
        /// </summary>
        /// <param name="text">The Text.</param>
        /// <param name="font">The Font.</param>
        /// <param name="position">The Position.</param>
        /// <param name="color">The Color.</param>
        public void DrawString(string text, Font font, Vector2 position, Color color)
        {
            var dxFont = font.Instance as DirectXFont;

            if (dxFont == null)
            {
                throw new ArgumentException("DirectX10 expects a DirectXFont as resource.");
            }

            _renderTarget.DrawText(text, dxFont.GetFont(),
                                   new RectangleF(position.X, position.Y, 9999, 9999), DirectXHelper.ConvertSolidColorBrush(color));
        }