Skip to content

Instantly share code, notes, and snippets.

@AungWinnHtut
Created April 15, 2018 14:51
Show Gist options
  • Save AungWinnHtut/4b196753a883b0f2e6b0332f1c35d341 to your computer and use it in GitHub Desktop.
Save AungWinnHtut/4b196753a883b0f2e6b0332f1c35d341 to your computer and use it in GitHub Desktop.
This program is to teach basic graphics for beginners
// frmGraphics.cs
// This program is to teach basic graphics for beginners
// need to add btnDraw and Timer1
// programmer: Dr. Aung Win Htut (Green Hackers)
// https://www.facebook.com/GreenHackersOTC
///////////////////////////////////////////////////////
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 _2018041501_CS_TrigoTest
{
public partial class frmGraphics : Form
{
Graphics myGraphics;
int i = 0;
public frmGraphics()
{
InitializeComponent();
}
private void btnDraw_Click(object sender, EventArgs e)
{
draw();
}
void draw()
{
myGraphics = base.CreateGraphics();
Pen myPen = new Pen(Color.Blue);
SolidBrush mySolidBrush = new SolidBrush(Color.Green);
myGraphics.Clear(Color.White);
myGraphics.DrawEllipse(myPen, i * 2, i, 50, 50);
myGraphics.Dispose();
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Enabled = false;
i = i + 5;
draw();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment