naren
naren

Reputation: 1

textbox user interface effect in winforms

How can i manage the text box got-focus like user enter on text box then text box back color changed for example yellow and user move next text box then color will white in whole window form application in c# each and every form text box will do this. how can i do with out using enter and leave event's of c#

Upvotes: 0

Views: 1042

Answers (2)

Theun Arbeider
Theun Arbeider

Reputation: 5409

I believe what you are looking for is something like this:

textboxName.GotFocus += (s, ea) =>
{
    ((TextBox)s).BackColor = Color.Black;
    ((TextBox)s).ForeColor = Color.White;
};
textboxName.LostFocus += (s, ea) =>
{
    ((TextBox)s).BackColor = Color.White;
    ((TextBox)s).ForeColor = Color.Black;
};

Where textboxName is the name of your textbox.

Upvotes: 2

Yanshof
Yanshof

Reputation: 9926

You can define class that derivative from the GUI object - and override the get focuse.

Upvotes: 0

Related Questions