3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by ddanbe
0

This question should probably be moved by a moderator to the web development section of the forums, but as far as your query goes: using images is a good way of achieving cross-browser compatibility. But if you do not want to use images, you can use CSS to achieve a gradient effect - look here :

http://slayeroffice.com/code/gradient/

Edited by majestic0110: n/a

1

Welcome to DANIWEB Minald!:)
Please post in the right forum.
However if you want to do this in a forms application you could do something like:

using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace GradientText
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.Width = 900;
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics G = e.Graphics;
            string strText = "Gradient";
            Font font = new Font("Arial", 144, FontStyle.Italic);
            SizeF aSize = G.MeasureString(strText, font);
            PointF aPoint = new PointF(20f, 20f);
            RectangleF aRect = new RectangleF(aPoint, aSize);

            LinearGradientBrush aBrush = new LinearGradientBrush(aRect, Color.White, Color.Blue,
                LinearGradientMode.ForwardDiagonal);
            G.Clear(Color.Gray);
            G.DrawString(strText, font, aBrush, aPoint);
        }
    }
}
Votes + Comments
Nice!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.