Graphics-Draw a Gradient string.


 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 

namespace MyBlog

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            using (Graphics GradientGraphic = this.CreateGraphics())

            {

                GradientGraphic.DrawString("Ghanashyam Nayak", new Font("Arial", 30, FontStyle.Bold), new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(10, 10, 100, 100), Color.Red, Color.Blue, System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal), new PointF(12.0F, 12.0F));

            }

 

        }

    }

}

 


Ebook Download
View all
Learn
View all