Form Focus

  • Thread starter Thread starter bwagz77
  • Start date Start date
B

bwagz77

Hi,

My app is basically a drawing application. Whenever you draw a shape
on the form, you can press the delete key to delete the shape. I
have added a bunch of buttons to the form and whenever the a button
is clicked the button gains focus. So when i select a shape on the
form I can't press the delete key to delete the shape. I tried
calling Form.Focus after a button is clicked, but this doesn't seem
to work. Is there any way to enable control back to the form after
something is done??

Thanks for any help!!
 
Hi bwagz7,

What kind of control you are trying to focus.

I tried this with UserControl and it works.

You cannot set focus using Focus method to som of the controls e.g.Panel,
Label, GroupBox, etc. Those controls are not meant to be focused. But you
still can focuse them by selecting them in Form's ActiveControl property.



--
B\rgds
100 [C# MVP]
bwagz77 said:
Hi,

My app is basically a drawing application. Whenever you draw a shape
on the form, you can press the delete key to delete the shape. I
have added a bunch of buttons to the form and whenever the a button
is clicked the button gains focus. So when i select a shape on the
form I can't press the delete key to delete the shape. I tried
calling Form.Focus after a button is clicked, but this doesn't seem
to work. Is there any way to enable control back to the form after
something is done??

Thanks for any help!!



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Hi Brian,

A suggestion...

Instead of using the form surface to do your drawing on, add a PictureBox
and do all your drawing in that. You can then set focus back to the
PictureBox whenever you need to.

HTH,
Gary

bwagz77 said:
Hi,

My app is basically a drawing application. Whenever you draw a shape
on the form, you can press the delete key to delete the shape. I
have added a bunch of buttons to the form and whenever the a button
is clicked the button gains focus. So when i select a shape on the
form I can't press the delete key to delete the shape. I tried
calling Form.Focus after a button is clicked, but this doesn't seem
to work. Is there any way to enable control back to the form after
something is done??

Thanks for any help!!



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Back
Top