Created
April 15, 2018 05:40
-
-
Save AungWinnHtut/649a7951aee06f314685980fd9c42514 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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