//this procedure will assign the color of its corresponding label //when its corresponding control has been focused private void SetLabelsColor() { if (!LabelColorsEventAssigned) { foreach (JkMasterColumn column in MasterColumns) { if (!String.IsNullOrWhiteSpace(column.LabelName) && !String.IsNullOrWhiteSpace(column.ControlName)) { Control label = splitContainer.Panel2.Controls.Find(column.LabelName, true).First(); Control control = splitContainer.Panel2.Controls.Find(column.ControlName, true).First(); if (label != null && control != null) { control.Enter += (obj, e) => { if (FormState != FormStates.fsView) { IAppHandler.SetLabelColorOnEnter(label as Label); } }; control.Leave += (obj, e) => { IAppHandler.SetLabelColorOnLeave(label as Label); }; } } } LabelColorsEventAssigned = true; } }
private void txtBalance_Leave(object sender, EventArgs e) { IAppHandler.SetLabelColorOnLeave(lblBalance); }
private void txtPassword_Leave(object sender, EventArgs e) { IAppHandler.SetLabelColorOnLeave(lblPassword); }
private void txtUsername_Leave(object sender, EventArgs e) { IAppHandler.SetLabelColorOnLeave(lblUsername); }