.NET Framework - Label Click event?

Asked By Alain Dekker on 22-Mar-11 06:28 PM
I have added a System.Windows.Forms.Label control to my form, and the only
events exposed are:

EnabledChanged
ParentChanged
TextChanged

No "Click" event. Is there any way to hook into that?

I notice that the System.Windows.Forms.LinkLabel *does* have a Click event,
but its also got an ugly underline in the text. Is there any way to get rid
of the underline.

I should mention that I am using Visual Studio 2005 and C# targetting Windows
CE 5.0 using .NET CF v2.0 in case its relevant.

Thanks,
Alain




Arne_Vajhøj replied to Alain Dekker on 22-Mar-11 07:40 PM
Usually it does not make much sense to click on a Label.

You read Label's, write text in TextBox'es, click
on Button's etc..

Arne
Peter Duniho replied to Alain Dekker on 22-Mar-11 08:18 PM
Only when the event is present on the control.  It is on the regular
.NET framework version of the control.  As it is inherited from the
System.Windows.Forms.Control class, it is actually present on _every_
control, at least in the regular version of .NET.


According to the docs, the Click event _is_ supported on Compact
Framework 2.0.  Note the mobile-phone icon by the Click event on this page:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control_events(v=VS.80).aspx

The main topic page in the 2.0 docs for the event specifically states
that it is supported in Compact Framework 2.0:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.click(v=VS.80).aspx

I cannot tell you why you are only seeing the three events you mention.
I suppose it is possible that the Designer is for some reason not showing
it, but you really ought to be able to at least write code that uses the
event and have that compile successfully.

Of course, this and all other CF-specific questions are much better
answered in a forum specifically for CF-specific questions.  Here, much
of what you are going to get is random guesses and shrugs.  In a
CF-specific forum, there is probably someone there who can tell you
exactly what problem you are running into and how to work around it.

Pete
Alain Dekker replied to Peter Duniho on 23-Mar-11 05:59 AM
OK thanks, I have now found the CompactFramework newsgroup and I will post
there when I think its relevant.

Regards,
Alain