public LoginForm(AppWindow owner) { InitializeComponent(); this.Dock = DockStyle.Fill; this.BackColor = owner.LightColor; owner.LeftPanel.Enabled = false; txtUsername = new HintedTextBox("username") { BorderStyle = System.Windows.Forms.BorderStyle.None, Font = new System.Drawing.Font(this.Font.FontFamily, 11.0F), Width = 300 }; UnderlineFor lblLine1 = new UnderlineFor(txtUsername, owner.DarkColor, SystemColors.GrayText) { BackColor = owner.DarkColor, }; this.Controls.Add(txtUsername); this.Controls.Add(lblLine1); txtPassword = new HintedTextBox("password") { BorderStyle = txtUsername.BorderStyle, Font = txtUsername.Font, //IsPasswordBox = true, Width = txtUsername.Width }; UnderlineFor lblLine2 = new UnderlineFor(txtPassword, owner.DarkColor, SystemColors.GrayText) { BackColor = SystemColors.GrayText, }; this.Controls.Add(txtPassword); this.Controls.Add(lblLine2); txtPassword.KeyDown += delegate { txtPassword.PasswordChar = '*'; }; btnLogin = new Button() { BackColor = owner.DarkColor, ForeColor = owner.LightColor, FlatStyle = FlatStyle.Flat, Font = new Font(this.Font.FontFamily, 16.0f, FontStyle.Bold), Size = new Size(txtUsername.Width, 50), Text = "Login" }; this.Controls.Add(btnLogin); btnLogin.Click += delegate { if (txtUsername.Text == "admin" && txtPassword.Text == "admin") { owner.LeftPanel.Enabled = true; owner.Body.Controls.Remove(this); } else { MessageBox.Show("Invalid username and password"); } }; this.SizeChanged += delegate { txtPassword.Location = new Point((this.Width - txtPassword.Width) / 2, (this.Height - txtPassword.Height) / 2); lblLine2.Location = new Point(txtPassword.Location.X, txtPassword.Bottom); txtUsername.Location = new Point(txtPassword.Left, txtPassword.Top - (txtUsername.Height + 20)); lblLine1.Location = new Point(txtUsername.Location.X, txtUsername.Bottom); btnLogin.Location = new Point(txtPassword.Location.X, txtPassword.Bottom + 20); }; }
public RegistrationForm(AppWindow owner) { InitializeComponent(); PopulateStatesAndLGAs(); this.Dock = DockStyle.Fill; this.BackColor = owner.LightColor; txtFirstname = new HintedTextBox("first name") { BorderStyle = System.Windows.Forms.BorderStyle.None, Font = new System.Drawing.Font(this.Font.FontFamily, 16.0F), Width = 300 }; txtFirstname.Location = new Point(100, 20); UnderlineFor lblLine1 = new UnderlineFor(txtFirstname, owner.DarkColor, SystemColors.GrayText) { BackColor = owner.DarkColor, }; lblLine1.Location = new Point(txtFirstname.Location.X, txtFirstname.Bottom); this.Controls.Add(txtFirstname); this.Controls.Add(lblLine1); txtLastName = new HintedTextBox("last name") { BorderStyle = txtFirstname.BorderStyle, Font = txtFirstname.Font, Width = txtFirstname.Width }; txtLastName.Location = new Point(txtFirstname.Left, txtFirstname.Bottom + 20); UnderlineFor lblLine2 = new UnderlineFor(txtLastName, owner.DarkColor, SystemColors.GrayText) { BackColor = SystemColors.GrayText, }; lblLine2.Location = new Point(txtLastName.Location.X, txtLastName.Bottom); this.Controls.Add(txtLastName); this.Controls.Add(lblLine2); txtOtherNames = new HintedTextBox("other names") { BorderStyle = txtFirstname.BorderStyle, Font = txtFirstname.Font, Width = txtFirstname.Width }; txtOtherNames.Location = new Point(txtLastName.Left, txtLastName.Bottom + 20); UnderlineFor lblLine3 = new UnderlineFor(txtOtherNames, owner.DarkColor, SystemColors.GrayText) { BackColor = SystemColors.GrayText, }; lblLine3.Location = new Point(txtOtherNames.Location.X, txtOtherNames.Bottom); this.Controls.Add(txtOtherNames); this.Controls.Add(lblLine3); btnDob = new RadioButton() { Checked = true, Font = txtFirstname.Font, Height = 30, Location = new Point(txtOtherNames.Location.X, txtOtherNames.Bottom + 20), Text = "I know my date of birth", Width = txtFirstname.Width, }; btnDob.CheckedChanged += delegate { datePicker.Enabled = btnDob.Checked; }; this.Controls.Add(btnDob); datePicker = new DateTimePicker() { Enabled = btnDob.Checked, Font = txtFirstname.Font, Location = new Point(btnDob.Left + 20, btnDob.Bottom + 5), Width = btnDob.Width - 20 }; this.Controls.Add(datePicker); btnYoB = new RadioButton() { Checked = false, Font = btnDob.Font, Height = btnDob.Height, Location = new Point(btnDob.Left, datePicker.Bottom + 20), Text = "I may know my age", Width = btnDob.Width }; btnYoB.CheckedChanged += delegate { txtAge.Enabled = btnYoB.Checked; }; this.Controls.Add(btnYoB); txtAge = new NumericUpDown()//HintedTextBox("estimated age") { BorderStyle = txtFirstname.BorderStyle, Enabled = btnYoB.Checked, Font = txtFirstname.Font, Maximum = 200, Minimum = 0, Width = datePicker.Width }; txtAge.Location = new Point(btnYoB.Left + 20, btnYoB.Bottom + 5); //UnderlineFor lblLine4 = new UnderlineFor(txtAge, owner.DarkColor, SystemColors.GrayText) //{ // BackColor = SystemColors.GrayText, //}; //lblLine4.Location = new Point(txtAge.Location.X, txtAge.Bottom); this.Controls.Add(txtAge); //this.Controls.Add(lblLine4); genderList = new ComboBox() { //DropDownStyle = ComboBoxStyle.DropDownList, Font = txtFirstname.Font, Location = new Point(txtFirstname.Left, txtAge.Bottom + 20), Text = "select gender", Width = txtFirstname.Width, }; genderList.Items.Add("Male"); genderList.Items.Add("Female"); this.Controls.Add(genderList); maritalStatusList = new ComboBox() { //DropDownStyle = ComboBoxStyle.DropDownList, Font = txtFirstname.Font, Location = new Point(txtFirstname.Left, genderList.Bottom + 20), Text = "select marital status", Width = txtFirstname.Width, }; maritalStatusList.Items.Add("Single"); maritalStatusList.Items.Add("Married"); maritalStatusList.Items.Add("Widowed"); maritalStatusList.Items.Add("Separated"); maritalStatusList.Items.Add("Others"); this.Controls.Add(maritalStatusList); statesList = new ComboBox() { //DropDownStyle = ComboBoxStyle.DropDownList, Font = txtFirstname.Font, Location = new Point(txtFirstname.Left, maritalStatusList.Bottom + 20), Text = "select state", Width = txtFirstname.Width, }; statesList.AutoCompleteCustomSource.AddRange(statesAndLGAs.Keys.ToArray()); statesList.AutoCompleteMode = AutoCompleteMode.Suggest; statesList.AutoCompleteSource = AutoCompleteSource.CustomSource; statesList.Items.AddRange(statesAndLGAs.Keys.ToArray()); statesList.SelectedIndexChanged += delegate { lgaList.Items.Clear(); if (statesList.SelectedItem != null) { var key = statesList.SelectedItem.ToString(); if (statesAndLGAs.ContainsKey(key)) { lgaList.Items.AddRange(statesAndLGAs[key]); } } }; this.Controls.Add(statesList); lgaList = new ComboBox() { //DropDownStyle = ComboBoxStyle.DropDownList, Font = txtFirstname.Font, Location = new Point(txtFirstname.Left, statesList.Bottom + 20), Text = "select LGA", Width = txtFirstname.Width, }; this.Controls.Add(lgaList); camControl = new TestForm1.RegistrationForm.CameraControl(owner); camControl.Location = new Point(txtFirstname.Right + 50, txtFirstname.Top); camControl.Size = new Size(txtFirstname.Width, txtFirstname.Width); this.Controls.Add(camControl); RecreateEnrollmentControl(); btnSave = new Button() { BackColor = owner.DarkColor, ForeColor = owner.LightColor, Font = new Font(this.Font.FontFamily, 16.0f, FontStyle.Bold), Size = new Size(100, 50), Text = "Save" }; this.Controls.Add(btnSave); btnSave.Click += BtnSave_Click; this.SizeChanged += delegate { btnSave.Location = new Point((this.Width - btnSave.Width) / 2, this.Height - (btnSave.Height + 2)); }; }