C# Code for Window Display Class File
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Dymetric
{
public partial class Form1 : Form
{
private Rectangle screen_rect;
private Dymetric action_class;
private bool CLICK_OCCURRED;
public Form1()
{
InitializeComponent();
screen_rect = Screen.PrimaryScreen.Bounds;
CLICK_OCCURRED = false;
action_class = new Dymetric(screen_rect.Width, screen_rect.Height);
}
private void Form1_Load(object sender, EventArgs e)
{
this.SetDesktopBounds(0, 0, screen_rect.Width, screen_rect.Height);
this.Text = "useOfMaths.com";
this.BackColor = Color.LightGray;
String path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
path = new Uri(path).LocalPath;
try
{
this.Icon = new Icon(path + "\\useOfMaths.ico");
}
catch(System.IO.FileNotFoundException ex)
{
}
Button response_btn = new Button();
response_btn.BackColor = Color.Magenta;
response_btn.ForeColor = Color.Blue;
response_btn.SetBounds(screen_rect.Width / 2 - 50, 5, 100, 40);
response_btn.Text = "Move";
response_btn.Click += new EventHandler(response_btn_Click);
this.Controls.Add(response_btn);
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Pen pencil = new Pen(Color.Black);
pencil.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
pencil.Width = 5;
e.Graphics.DrawLine(pencil, 0, 50, this.Width, 50);
pencil.Dispose();
Brush paint_brush = new SolidBrush(Color.Pink);
e.Graphics.FillRectangle(paint_brush, 0, 0, this.Width, 50);
paint_brush.Dispose();
action_class.decideAction(e, CLICK_OCCURRED);
CLICK_OCCURRED = false;
}
public void response_btn_Click(object sender, EventArgs e)
{
CLICK_OCCURRED = true;
this.Refresh();
}
private void Form1_Load_1(object sender, EventArgs e)
{
}
}
}