begin and initialise coursework project
This commit is contained in:
69
HCI_Coursework_EVCHARGE/Form3.cs
Normal file
69
HCI_Coursework_EVCHARGE/Form3.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HCI_Coursework_EVCHARGE
|
||||
{
|
||||
public partial class Keyboard : Form
|
||||
{
|
||||
TextBox entryBox;
|
||||
bool capsLock = true;
|
||||
|
||||
public Keyboard()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.TopMost = true;
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
}
|
||||
|
||||
public void setTextBox(TextBox textBox)
|
||||
{
|
||||
entryBox = textBox;
|
||||
}
|
||||
|
||||
|
||||
private void button_Click(object sender, EventArgs e)
|
||||
{
|
||||
if( capsLock == true )
|
||||
{
|
||||
entryBox.Text += ((Button)sender).Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
entryBox.Text += ((Button)sender).Text.ToLower();
|
||||
}
|
||||
}
|
||||
|
||||
private void backspace_Click(object sender, EventArgs e)
|
||||
{
|
||||
if ( entryBox.Text.Length > 0 )
|
||||
{
|
||||
entryBox.Text = entryBox.Text.Substring(0, entryBox.Text.Length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void space_Click(object obj, EventArgs e)
|
||||
{
|
||||
entryBox.Text += " ";
|
||||
}
|
||||
|
||||
private void caps_Click(object sender, EventArgs e)
|
||||
{
|
||||
if ( capsLock == true )
|
||||
{
|
||||
capsLock = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
capsLock = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user