CSharp/C# >> Prevent label from getting focus

by dmeglio » Tue, 09 Sep 2008 06:15:21 GMT

I have a label control on a form and when I click on it, it "receives"
that message. I need the Panel that contains the Label to receive the
message instead (for drag and drop reasons). If I set the label's
Enabled=false property, it works as expected, however the text grays
out. Is there any way to do this without disabiling the label?

This is for .NET 1.1 by the way.

Thanks in advance!

Similar Threads

1. preventing the label from getting focus? - .NET Windows Forms

2. Preventing a form from getting focus

Is there a way to prevent a form from getting focus?

Thanks!
- Pete


3. Prevent a Object (TrackBar) from getting 'Focus'. - Borland C++ Builder VCL Components

4. Preventing textBox from getting focus ?

Does anyone have an idea on how to prevent a textbox from getting focus i.e.
the same function as "textBox.enabled = false" but without making the text
written in gray ?

This code works:
private void textBox1_GotFocus(object sender, System.EventArgs e)
{
textBox1.Parent.Focus(); // the form got the focus instead
}
but I would prefer to make a new control - let's call it an indicator, that
implements the above functionality.

Thanks!
Ole


5. Prevent my app from getting the focus - .NET Windows Forms

6. ToolStripComboBox: How to prevent from getting focus

7. Prevent scroll into view on getting focus - .NET Windows Forms

8. Prevent a DataGrid in Windows Form Getting Focus

Dear all,

How to prevent a datagrid in Windows form getting focus?  Even user click on 
it.  

I use barcode scanner as input and display the result in a datagrid.  My 
problem is when the datagrid got focus, the scanner input will be discarded.  
I cannot find any event to handle the input.

Thanks,

Tedmond