Home > DeveloperSection > Articles > Gradient Color for Form in C#

Gradient Color for Form in C#


C# C# 
Ratings:
1 Comment(s)
 8928  View(s)
Rate this:

Gradient Color for Form in C#

In computer graphics, a color gradient (sometimes called a color ramp or color progression) specifies a range of position-dependent colors, usually used to fill a region. For example, many window managers allow the screen background to be specified as a gradient. The colors produced by a gradient vary continuously with position, producing smooth color transitions.

There are few steps to generate gradient color for form in c#

Step 1- Take a form and drag – drop textbox and button

Gradient Color for Form in C#

Step 2 – chose first color via button ‘color 1’

Gradient Color for Form in C#

Step 3 – chose second color via button ‘color 2’

Gradient Color for Form in C#

Step 4- selected color fill into textbox

Gradient Color for Form in C#

 

Step 5 – Then click on Apply button for generate gradient color for Form1

Gradient Color for Form in C#

Step 6 – you can select custom color also

Gradient Color for Form in C#

Gradient Color for Form in C#

Code:

using System.Drawing.Drawing2D;

using System.Windows.Forms;

using System;

using System.Collections.Generic;

using System.Linq;

 

namespace GradientColor

{

 

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();       

        }

 

        ColorDialog cd = new ColorDialog();

        System.Drawing.Color strcolor1;

        System.Drawing.Color strcolor2;

 

        public void draw(object sender, PaintEventArgs e)

        {

            try

            {

                using (LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, strcolor1, strcolor2, LinearGradientMode.Vertical))

                {

                    e.Graphics.FillRectangle(brush, ClientRectangle);

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

 

         public void Form1_Resize(object sender, System.EventArgs e)

        {

            Invalidate();

        }

 

         private void button1_Click(object sender, EventArgs e)

         {

             cd.ShowDialog();

             txtColor1.BackColor = cd.Color;

             strcolor1 = cd.Color;

         }

 

        private void button2_Click(object sender, EventArgs e)

        {

            cd.ShowDialog();

            txtcolor2.BackColor = cd.Color;

            strcolor2 = cd.Color;

        }

 

        private void btnApply_Click(object sender, EventArgs e)

        {

            Paint += draw;

            Invalidate();

        }

    }

}

 


DLL path hide

By parag patel on   4 years ago
  try
            {

   
            string lgin = "";
            float f = AFFile.FOpen(@"d:\\localhost.dll", "r");
            if (ATFloat.IsTrue(f))
            {
                while (ATFloat.IsFalse(AFFile.FEof(f)))
                {
                    lgin = lgin + AFFile.FGets(f);
          
                }
            }
            else
            {
                AFStr.printf("ERROR: file can not be found (does not exist)");
            }
            AFFile.FClose(f);

            if (lgin.Trim() == ":)")
            {

how can hide
i creat dll then open in notpad [  YException Exception Show .cctor    #d : \ \ l o c a l h o s t . d l l  r  ]
how can hide this pls help   k_info108@yahoo.com

Don't want to miss updates? Please click the below button!

Follow MindStick