Skip to content

Instantly share code, notes, and snippets.

@AungWinnHtut
Created April 15, 2018 05:40
Show Gist options
  • Save AungWinnHtut/649a7951aee06f314685980fd9c42514 to your computer and use it in GitHub Desktop.
Save AungWinnHtut/649a7951aee06f314685980fd9c42514 to your computer and use it in GitHub Desktop.
//https://www.c-sharpcorner.com/article/gdi-tutorial-for-beginners/
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;
using System.Drawing.Drawing2D;
namespace _2018041501_CS_TrigoTest
{
public partial class Form1 : Form
{
Graphics g;
int i = 50;
public Form1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs pe)
{
g = pe.Graphics;
Point pt1 = new Point(150, 150);
Point pt2 = new Point(300, 150);
Pen pn = new Pen(Color.Red);
Rectangle rect = new Rectangle(i, i, 100, 100);
LinearGradientBrush lBrush = new LinearGradientBrush(rect, Color.Red, Color.Yellow, LinearGradientMode.BackwardDiagonal);
g.FillRectangle(lBrush, rect);
g.DrawLine(pn,pt1, pt2);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment