Panel SetFocus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everybody!

In our application we have a row of panels that act as a navigation panel -
looking similar to a tree.

It works fine, all the panels can be clicked and the related action is
performed.

It got a requirement that this control must be accessable by keyboard, so it
must have something like a focus.

Any ideas how to get out of this mess?

I am new to .NET and C#.

Christoph
 
Ladachris said:
In our application we have a row of panels that act as a navigation
panel -
looking similar to a tree.

It works fine, all the panels can be clicked and the related action is
performed.

It got a requirement that this control must be accessable by keyboard, so
it
must have something like a focus.

Panels are conainer controls and cannot get the focus. I suggest to use
another control like the button control instead of the panel controls. You
can override the button's 'OnPaint' method in order to draw it the way you
want it to appear.
 
It you must use the Panel then you should derive a class from it and inside
the constructor you can set the ControlStyles.Selectable so that it can
receive the focus. But probably a better solution would be to create a new
custom control by inheriting from UserControl instead.

Phil Wright
Follow my C# microISV startup at...
http://componentfactory.blogspot.com
 
Back
Top