By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,965 Members | 2,043 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,965 IT Pros & Developers. It's quick & easy.

Selectable User-Drawn Control

P: 2
Hi all.
I've built a class based on "Control" and I want this object of mine to be
selectable. I believe that, by default, Control is non-selectable so I used
this.SetStyle(ControlStyles.Selectable, true);

And it works fine when I use TAB key, but when I click on my object, the
focus remains on the current object.

What am I doing wrong?

Jan 7 '09 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 3,525
One though: Set the "Click" event of your control to this.Focus();
Jan 9 '09 #2

P: 2
Thanks, tlhintoq.
I've found a nice way in another thread.

if (this.CanSelect) this.Select();

I used this on override OnMouseDown
Jan 9 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.