begin and initialise coursework project
This commit is contained in:
46
HCI_Coursework_EVCHARGE/Form2.cs
Normal file
46
HCI_Coursework_EVCHARGE/Form2.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HCI_Coursework_EVCHARGE
|
||||
{
|
||||
public partial class AccountDetailForm : Form
|
||||
{
|
||||
Keyboard keyboard;
|
||||
public AccountDetailForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.ActiveControl = this.loginLabel;
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
}
|
||||
|
||||
private void accountNo_Focus(object sender, EventArgs e)
|
||||
{
|
||||
TextBox textBox = (TextBox)sender; // take a copy of the object reference for the particular textbox pressed
|
||||
|
||||
if (keyboard == null) // check if the keyboard is already created
|
||||
{
|
||||
keyboard = new Keyboard(); // no keyboard so create an instance of one
|
||||
keyboard.FormClosed += delegate
|
||||
{
|
||||
keyboard = null; // when the keyboard is closed, dispose of the keyboard instance
|
||||
this.ActiveControl = loginLabel; // when the keyboard is closed, reset focus to the dummy label else
|
||||
// it will give focus to a textbox which would trigger the event to
|
||||
// make another keyboard appear.
|
||||
};
|
||||
}
|
||||
keyboard.setTextBox(textBox); // tell the keyboard which textbox to send its characters too
|
||||
keyboard.Show(); // show the keyboard
|
||||
|
||||
keyboard.Top = this.Top + textBox.Top + textBox.Height + 30;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user