enabled property of stock controls, specifically labels 
Author Message
 enabled property of stock controls, specifically labels

Hello - I have a panel with a couple of labels in it and the labels
have their text showing up in blue and yellow. When I set the panels
enabled property to false, the labels lose their blue & yellow
colours. Can I stop this?
Many thanks
Monty


Thu, 25 Nov 2004 22:54:12 GMT  
 enabled property of stock controls, specifically labels
The purpose to change the color of the Label is to show that it is disable.
You might want to disable individuals items in the panel instead of
disabling the whole panel.

Barry Tang
VB Dev

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Hello - I have a panel with a couple of labels in it and the labels
> have their text showing up in blue and yellow. When I set the panels
> enabled property to false, the labels lose their blue & yellow
> colours. Can I stop this?
> Many thanks
> Monty



Sun, 28 Nov 2004 04:16:20 GMT  
 enabled property of stock controls, specifically labels
Firstly thank you for your reply.

The 'fuller' scenario is this.
1. I have a lot of controls on a panel in a usercontrol.
2. I need to catch the MouseOver event (and others) in the
   form that the usercontrol is sitting on.
3. When the panel is enabled, the MouseOver event of the
   usercontrol is not raised. When the panel is disabled,
   it is.

Thus, my reason for wanting to disable the panel is not
to disable the controls, but to allow these 'normal' events
to occur. I want the labels etc to look the same
regardless of whether they are enabled or disabled.

I have explored two current workarounds:

1. To raise the events (specifically MouseOver, MouseMove,
   MouseEnter) etc in the usercontrol by specifically  
   overriding the events in the panel and raising then
   manually raising the respective events in the usercontrol.
   Adds a bit of code to the control and all up sort of has
   an amateur feel about it.
2. To remove the controls from the panel and just place then
   directly on the usercontrol (so that MouseOver etc are
   raised by the usercontrol on the parent form). The main
   impetus for putting the labels etc on the panel in the first
   instance is that I want to move them around in a group.
   By not putting them on a panel, I have to move all the
   labels etc manually.

I'm really not wanting to implement either of these solutions
in the deployment version of my application. What I really
desire is a label and other simple controls that do not
change appearance when disabled, or a nifty little way of
subclassing these controls so that there appearance doesn't
change when enabled/disabled.

As I can see this requirement being common (at least in a specific
application I am currently working on), I need to test the water
and confirm that I am not missing something obvious. It would have
been so nice if someone had replied saying "Dummkopf, try this".

  label1.ChangeAppearanceOnDisabled = False

But I'm open to all solutions as I will almost certainly have to
revisit this issue later in the week if there isn't a known way to
implement the functionality I require.

Again thank you for thinking about the problem.
Monty


Quote:
> The purpose to change the color of the Label is to show that it is disable.
> You might want to disable individuals items in the panel instead of
> disabling the whole panel.

> Barry Tang
> VB Dev

> --
> This posting is provided "AS IS" with no warranties, and confers no rights.



> > Hello - I have a panel with a couple of labels in it and the labels
> > have their text showing up in blue and yellow. When I set the panels
> > enabled property to false, the labels lose their blue & yellow
> > colours. Can I stop this?
> > Many thanks
> > Monty



Sun, 28 Nov 2004 16:32:57 GMT  
 enabled property of stock controls, specifically labels
Hey there,

We tried to recreate your issue and found the following:

1. We added MouseEnter events to a label in the panel in the usercontrol.
This event fired when the usercontrol was enabled, didn't fire when it
wasn't.
 2. We added code to the MouseEnter event of the usercontrol (in the form).
This event also fired only when the usercontrol was enabled.

So, basically, we are getting the opposite of what you did. A few
suggestions:

 1. Did we miss something? Let us know.
 2. You can move multiple labels at once by ctrl-click or shift-click to
multi-select.

We still feel like we're missing something, but we hope this helps.

Barry Tang
Developer, VB.NET
--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Firstly thank you for your reply.

> The 'fuller' scenario is this.
> 1. I have a lot of controls on a panel in a usercontrol.
> 2. I need to catch the MouseOver event (and others) in the
>    form that the usercontrol is sitting on.
> 3. When the panel is enabled, the MouseOver event of the
>    usercontrol is not raised. When the panel is disabled,
>    it is.

> Thus, my reason for wanting to disable the panel is not
> to disable the controls, but to allow these 'normal' events
> to occur. I want the labels etc to look the same
> regardless of whether they are enabled or disabled.

> I have explored two current workarounds:

> 1. To raise the events (specifically MouseOver, MouseMove,
>    MouseEnter) etc in the usercontrol by specifically
>    overriding the events in the panel and raising then
>    manually raising the respective events in the usercontrol.
>    Adds a bit of code to the control and all up sort of has
>    an amateur feel about it.
> 2. To remove the controls from the panel and just place then
>    directly on the usercontrol (so that MouseOver etc are
>    raised by the usercontrol on the parent form). The main
>    impetus for putting the labels etc on the panel in the first
>    instance is that I want to move them around in a group.
>    By not putting them on a panel, I have to move all the
>    labels etc manually.

> I'm really not wanting to implement either of these solutions
> in the deployment version of my application. What I really
> desire is a label and other simple controls that do not
> change appearance when disabled, or a nifty little way of
> subclassing these controls so that there appearance doesn't
> change when enabled/disabled.

> As I can see this requirement being common (at least in a specific
> application I am currently working on), I need to test the water
> and confirm that I am not missing something obvious. It would have
> been so nice if someone had replied saying "Dummkopf, try this".

>   label1.ChangeAppearanceOnDisabled = False

> But I'm open to all solutions as I will almost certainly have to
> revisit this issue later in the week if there isn't a known way to
> implement the functionality I require.

> Again thank you for thinking about the problem.
> Monty




- Show quoted text -

Quote:
> > The purpose to change the color of the Label is to show that it is
disable.
> > You might want to disable individuals items in the panel instead of
> > disabling the whole panel.

> > Barry Tang
> > VB Dev

> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.



> > > Hello - I have a panel with a couple of labels in it and the labels
> > > have their text showing up in blue and yellow. When I set the panels
> > > enabled property to false, the labels lose their blue & yellow
> > > colours. Can I stop this?
> > > Many thanks
> > > Monty



Mon, 29 Nov 2004 03:46:20 GMT  
 enabled property of stock controls, specifically labels
I really appreciate this followup by you guys. Thank you.

In direct answer to your question, yes we are doing different things.
ALWAYS my UserControl is enabled, and this will always be the case. I
am just DISABLING THE PANEL containing the labels WITHIN my
UserControl.

This is what I see: When the panel is disabled, the labels colour etc
change colour yet I can catch the MouseOver etc events for the
UserControl. When the panel is enabled, the label colour appears how
it should but the MouseOver etc events for the UserControl are not
raised.

I want to be able to catch the events for MouseOver etc, have the
labels be the colour I set them in the properties window, and have the
labels on a panel so I can simply move them around in a block.

Best regards
Monty


Quote:
> Hey there,

> We tried to recreate your issue and found the following:

> 1. We added MouseEnter events to a label in the panel in the usercontrol.
> This event fired when the usercontrol was enabled, didn't fire when it
> wasn't.
>  2. We added code to the MouseEnter event of the usercontrol (in the form).
> This event also fired only when the usercontrol was enabled.

> So, basically, we are getting the opposite of what you did. A few
> suggestions:

>  1. Did we miss something? Let us know.
>  2. You can move multiple labels at once by ctrl-click or shift-click to
> multi-select.

> We still feel like we're missing something, but we hope this helps.

> Barry Tang
> Developer, VB.NET
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.



> > Firstly thank you for your reply.

> > The 'fuller' scenario is this.
> > 1. I have a lot of controls on a panel in a usercontrol.
> > 2. I need to catch the MouseOver event (and others) in the
> >    form that the usercontrol is sitting on.
> > 3. When the panel is enabled, the MouseOver event of the
> >    usercontrol is not raised. When the panel is disabled,
> >    it is.

> > Thus, my reason for wanting to disable the panel is not
> > to disable the controls, but to allow these 'normal' events
> > to occur. I want the labels etc to look the same
> > regardless of whether they are enabled or disabled.

> > I have explored two current workarounds:

> > 1. To raise the events (specifically MouseOver, MouseMove,
> >    MouseEnter) etc in the usercontrol by specifically
> >    overriding the events in the panel and raising then
> >    manually raising the respective events in the usercontrol.
> >    Adds a bit of code to the control and all up sort of has
> >    an amateur feel about it.
> > 2. To remove the controls from the panel and just place then
> >    directly on the usercontrol (so that MouseOver etc are
> >    raised by the usercontrol on the parent form). The main
> >    impetus for putting the labels etc on the panel in the first
> >    instance is that I want to move them around in a group.
> >    By not putting them on a panel, I have to move all the
> >    labels etc manually.

> > I'm really not wanting to implement either of these solutions
> > in the deployment version of my application. What I really
> > desire is a label and other simple controls that do not
> > change appearance when disabled, or a nifty little way of
> > subclassing these controls so that there appearance doesn't
> > change when enabled/disabled.

> > As I can see this requirement being common (at least in a specific
> > application I am currently working on), I need to test the water
> > and confirm that I am not missing something obvious. It would have
> > been so nice if someone had replied saying "Dummkopf, try this".

> >   label1.ChangeAppearanceOnDisabled = False

> > But I'm open to all solutions as I will almost certainly have to
> > revisit this issue later in the week if there isn't a known way to
> > implement the functionality I require.

> > Again thank you for thinking about the problem.
> > Monty



> > > The purpose to change the color of the Label is to show that it is
>  disable.
> > > You might want to disable individuals items in the panel instead of
> > > disabling the whole panel.

> > > Barry Tang
> > > VB Dev

> > > --
> > > This posting is provided "AS IS" with no warranties, and confers no
>  rights.



> > > > Hello - I have a panel with a couple of labels in it and the labels
> > > > have their text showing up in blue and yellow. When I set the panels
> > > > enabled property to false, the labels lose their blue & yellow
> > > > colours. Can I stop this?
> > > > Many thanks
> > > > Monty



Mon, 29 Nov 2004 16:12:47 GMT  
 enabled property of stock controls, specifically labels
Is that possible for you to post your code so we can look at it in more
details. It seems like we are doing the exact same thing but getting the
opposite result.

Barry Tang
Developer, VB.NET

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> I really appreciate this followup by you guys. Thank you.

> In direct answer to your question, yes we are doing different things.
> ALWAYS my UserControl is enabled, and this will always be the case. I
> am just DISABLING THE PANEL containing the labels WITHIN my
> UserControl.

> This is what I see: When the panel is disabled, the labels colour etc
> change colour yet I can catch the MouseOver etc events for the
> UserControl. When the panel is enabled, the label colour appears how
> it should but the MouseOver etc events for the UserControl are not
> raised.

> I want to be able to catch the events for MouseOver etc, have the
> labels be the colour I set them in the properties window, and have the
> labels on a panel so I can simply move them around in a block.

> Best regards
> Monty




- Show quoted text -

Quote:
> > Hey there,

> > We tried to recreate your issue and found the following:

> > 1. We added MouseEnter events to a label in the panel in the
usercontrol.
> > This event fired when the usercontrol was enabled, didn't fire when it
> > wasn't.
> >  2. We added code to the MouseEnter event of the usercontrol (in the
form).
> > This event also fired only when the usercontrol was enabled.

> > So, basically, we are getting the opposite of what you did. A few
> > suggestions:

> >  1. Did we miss something? Let us know.
> >  2. You can move multiple labels at once by ctrl-click or shift-click to
> > multi-select.

> > We still feel like we're missing something, but we hope this helps.

> > Barry Tang
> > Developer, VB.NET
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.



> > > Firstly thank you for your reply.

> > > The 'fuller' scenario is this.
> > > 1. I have a lot of controls on a panel in a usercontrol.
> > > 2. I need to catch the MouseOver event (and others) in the
> > >    form that the usercontrol is sitting on.
> > > 3. When the panel is enabled, the MouseOver event of the
> > >    usercontrol is not raised. When the panel is disabled,
> > >    it is.

> > > Thus, my reason for wanting to disable the panel is not
> > > to disable the controls, but to allow these 'normal' events
> > > to occur. I want the labels etc to look the same
> > > regardless of whether they are enabled or disabled.

> > > I have explored two current workarounds:

> > > 1. To raise the events (specifically MouseOver, MouseMove,
> > >    MouseEnter) etc in the usercontrol by specifically
> > >    overriding the events in the panel and raising then
> > >    manually raising the respective events in the usercontrol.
> > >    Adds a bit of code to the control and all up sort of has
> > >    an amateur feel about it.
> > > 2. To remove the controls from the panel and just place then
> > >    directly on the usercontrol (so that MouseOver etc are
> > >    raised by the usercontrol on the parent form). The main
> > >    impetus for putting the labels etc on the panel in the first
> > >    instance is that I want to move them around in a group.
> > >    By not putting them on a panel, I have to move all the
> > >    labels etc manually.

> > > I'm really not wanting to implement either of these solutions
> > > in the deployment version of my application. What I really
> > > desire is a label and other simple controls that do not
> > > change appearance when disabled, or a nifty little way of
> > > subclassing these controls so that there appearance doesn't
> > > change when enabled/disabled.

> > > As I can see this requirement being common (at least in a specific
> > > application I am currently working on), I need to test the water
> > > and confirm that I am not missing something obvious. It would have
> > > been so nice if someone had replied saying "Dummkopf, try this".

> > >   label1.ChangeAppearanceOnDisabled = False

> > > But I'm open to all solutions as I will almost certainly have to
> > > revisit this issue later in the week if there isn't a known way to
> > > implement the functionality I require.

> > > Again thank you for thinking about the problem.
> > > Monty



> > > > The purpose to change the color of the Label is to show that it is
> >  disable.
> > > > You might want to disable individuals items in the panel instead of
> > > > disabling the whole panel.

> > > > Barry Tang
> > > > VB Dev

> > > > --
> > > > This posting is provided "AS IS" with no warranties, and confers no
> >  rights.



> > > > > Hello - I have a panel with a couple of labels in it and the
labels
> > > > > have their text showing up in blue and yellow. When I set the
panels
> > > > > enabled property to false, the labels lose their blue & yellow
> > > > > colours. Can I stop this?
> > > > > Many thanks
> > > > > Monty



Tue, 30 Nov 2004 03:32:47 GMT  
 enabled property of stock controls, specifically labels
Alright, here's the code that I use.

Create a new project with a single form (form1) and a single
usercontrol (usercontrol1). Paste the following code into each.

Good luck.
Monty

CODE TO BE PASTED INTO FORM1
******************************************************

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form
Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
    Friend WithEvents UserControl11 As
WindowsApplication4.UserControl1
    <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.CheckBox1 = New System.Windows.Forms.CheckBox()
        Me.UserControl11 = New WindowsApplication4.UserControl1()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(29, 10)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(225, 77)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "I would like to be able to catch the mouse
enter event when I move the cursor ove" & _
        "r the yellow user control below. Importantly I want the text
in the UserControl " & _
        "to always appear enabled."
        '
        'CheckBox1
        '
        Me.CheckBox1.Location = New System.Drawing.Point(25, 101)
        Me.CheckBox1.Name = "CheckBox1"
        Me.CheckBox1.Size = New System.Drawing.Size(227, 16)
        Me.CheckBox1.TabIndex = 1
        Me.CheckBox1.Text = "Enable panel in user control"
        '
        'UserControl11
        '
        Me.UserControl11.Location = New System.Drawing.Point(50, 153)
        Me.UserControl11.Name = "UserControl11"
        Me.UserControl11.Size = New System.Drawing.Size(131, 84)
        Me.UserControl11.TabIndex = 2
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.UserControl11, Me.CheckBox1, Me.Label1})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub CheckBox1_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CheckBox1.CheckedChanged
        UserControl11.SetPanelEnabledOrDisabled = CheckBox1.Checked
    End Sub

    Private Sub UserControl11_MouseEnter(ByVal sender As
System.Object, ByVal e As EventArgs) Handles UserControl11.MouseEnter
        MsgBox("Mouse Enter")
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        UserControl11.SetPanelEnabledOrDisabled = CheckBox1.Checked
    End Sub
End Class

CODE TO BE PASTED INTO USERCONTROL1
******************************************************
Public Class UserControl1
    Inherits System.Windows.Forms.UserControl

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'UserControl overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form
Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Panel1 As System.Windows.Forms.Panel
    Friend WithEvents Label1 As System.Windows.Forms.Label
    <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
InitializeComponent()
        Me.Panel1 = New System.Windows.Forms.Panel()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Panel1.SuspendLayout()
        Me.SuspendLayout()
        '
        'Panel1
        '
        Me.Panel1.BackColor = System.Drawing.Color.Yellow
        Me.Panel1.Controls.AddRange(New System.Windows.Forms.Control()
{Me.Label1})
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(140, 93)
        Me.Panel1.TabIndex = 0
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.ForeColor = System.Drawing.Color.Blue
        Me.Label1.Location = New System.Drawing.Point(19, 7)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(96, 74)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "I would like this text to always to appear
blue (or whatever colour it is when it" & _
        " is enabled)"
        '
        'UserControl1
        '
        Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.Panel1})
        Me.Name = "UserControl1"
        Me.Size = New System.Drawing.Size(141, 93)
        Me.Panel1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

#Region "Usercontrol user code"

#End Region

    Public WriteOnly Property SetPanelEnabledOrDisabled() As Boolean
        Set(ByVal vblnEnablePanel As Boolean)
            Panel1.Enabled = vblnEnablePanel
        End Set
    End Property

    Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

    End Sub
End Class



Sat, 04 Dec 2004 03:47:23 GMT  
 enabled property of stock controls, specifically labels
The color change of the disabled control is a Windows Default.  In order to
achieve what you are trying to do, inherit the control, and then override
the Enabled property to ignore events, and behave the way you would like it
to behave.

Ed Smith, Glen Kowalski

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Alright, here's the code that I use.

> Create a new project with a single form (form1) and a single
> usercontrol (usercontrol1). Paste the following code into each.

> Good luck.
> Monty

> CODE TO BE PASTED INTO FORM1
> ******************************************************

> Public Class Form1
>     Inherits System.Windows.Forms.Form

> #Region " Windows Form Designer generated code "

>     Public Sub New()
>         MyBase.New()

>         'This call is required by the Windows Form Designer.
>         InitializeComponent()

>         'Add any initialization after the InitializeComponent() call

>     End Sub

>     'Form overrides dispose to clean up the component list.
>     Protected Overloads Overrides Sub Dispose(ByVal disposing As
> Boolean)
>         If disposing Then
>             If Not (components Is Nothing) Then
>                 components.Dispose()
>             End If
>         End If
>         MyBase.Dispose(disposing)
>     End Sub

>     'Required by the Windows Form Designer
>     Private components As System.ComponentModel.IContainer

>     'NOTE: The following procedure is required by the Windows Form
> Designer
>     'It can be modified using the Windows Form Designer.
>     'Do not modify it using the code editor.
>     Friend WithEvents Label1 As System.Windows.Forms.Label
>     Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
>     Friend WithEvents UserControl11 As
> WindowsApplication4.UserControl1
>     <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
> InitializeComponent()
>         Me.Label1 = New System.Windows.Forms.Label()
>         Me.CheckBox1 = New System.Windows.Forms.CheckBox()
>         Me.UserControl11 = New WindowsApplication4.UserControl1()
>         Me.SuspendLayout()
>         '
>         'Label1
>         '
>         Me.Label1.Location = New System.Drawing.Point(29, 10)
>         Me.Label1.Name = "Label1"
>         Me.Label1.Size = New System.Drawing.Size(225, 77)
>         Me.Label1.TabIndex = 0
>         Me.Label1.Text = "I would like to be able to catch the mouse
> enter event when I move the cursor ove" & _
>         "r the yellow user control below. Importantly I want the text
> in the UserControl " & _
>         "to always appear enabled."
>         '
>         'CheckBox1
>         '
>         Me.CheckBox1.Location = New System.Drawing.Point(25, 101)
>         Me.CheckBox1.Name = "CheckBox1"
>         Me.CheckBox1.Size = New System.Drawing.Size(227, 16)
>         Me.CheckBox1.TabIndex = 1
>         Me.CheckBox1.Text = "Enable panel in user control"
>         '
>         'UserControl11
>         '
>         Me.UserControl11.Location = New System.Drawing.Point(50, 153)
>         Me.UserControl11.Name = "UserControl11"
>         Me.UserControl11.Size = New System.Drawing.Size(131, 84)
>         Me.UserControl11.TabIndex = 2
>         '
>         'Form1
>         '
>         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
>         Me.ClientSize = New System.Drawing.Size(292, 273)
>         Me.Controls.AddRange(New System.Windows.Forms.Control()
> {Me.UserControl11, Me.CheckBox1, Me.Label1})
>         Me.Name = "Form1"
>         Me.Text = "Form1"
>         Me.ResumeLayout(False)

>     End Sub

> #End Region

>     Private Sub CheckBox1_CheckedChanged(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> CheckBox1.CheckedChanged
>         UserControl11.SetPanelEnabledOrDisabled = CheckBox1.Checked
>     End Sub

>     Private Sub UserControl11_MouseEnter(ByVal sender As
> System.Object, ByVal e As EventArgs) Handles UserControl11.MouseEnter
>         MsgBox("Mouse Enter")
>     End Sub

>     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>         UserControl11.SetPanelEnabledOrDisabled = CheckBox1.Checked
>     End Sub
> End Class

> CODE TO BE PASTED INTO USERCONTROL1
> ******************************************************
> Public Class UserControl1
>     Inherits System.Windows.Forms.UserControl

> #Region " Windows Form Designer generated code "

>     Public Sub New()
>         MyBase.New()

>         'This call is required by the Windows Form Designer.
>         InitializeComponent()

>         'Add any initialization after the InitializeComponent() call

>     End Sub

>     'UserControl overrides dispose to clean up the component list.
>     Protected Overloads Overrides Sub Dispose(ByVal disposing As
> Boolean)
>         If disposing Then
>             If Not (components Is Nothing) Then
>                 components.Dispose()
>             End If
>         End If
>         MyBase.Dispose(disposing)
>     End Sub

>     'Required by the Windows Form Designer
>     Private components As System.ComponentModel.IContainer

>     'NOTE: The following procedure is required by the Windows Form
> Designer
>     'It can be modified using the Windows Form Designer.
>     'Do not modify it using the code editor.
>     Friend WithEvents Panel1 As System.Windows.Forms.Panel
>     Friend WithEvents Label1 As System.Windows.Forms.Label
>     <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
> InitializeComponent()
>         Me.Panel1 = New System.Windows.Forms.Panel()
>         Me.Label1 = New System.Windows.Forms.Label()
>         Me.Panel1.SuspendLayout()
>         Me.SuspendLayout()
>         '
>         'Panel1
>         '
>         Me.Panel1.BackColor = System.Drawing.Color.Yellow
>         Me.Panel1.Controls.AddRange(New System.Windows.Forms.Control()
> {Me.Label1})
>         Me.Panel1.Name = "Panel1"
>         Me.Panel1.Size = New System.Drawing.Size(140, 93)
>         Me.Panel1.TabIndex = 0
>         '
>         'Label1
>         '
>         Me.Label1.Font = New System.Drawing.Font("Microsoft Sans
> Serif", 8.25!, System.Drawing.FontStyle.Bold,
> System.Drawing.GraphicsUnit.Point, CType(0, Byte))
>         Me.Label1.ForeColor = System.Drawing.Color.Blue
>         Me.Label1.Location = New System.Drawing.Point(19, 7)
>         Me.Label1.Name = "Label1"
>         Me.Label1.Size = New System.Drawing.Size(96, 74)
>         Me.Label1.TabIndex = 0
>         Me.Label1.Text = "I would like this text to always to appear
> blue (or whatever colour it is when it" & _
>         " is enabled)"
>         '
>         'UserControl1
>         '
>         Me.Controls.AddRange(New System.Windows.Forms.Control()
> {Me.Panel1})
>         Me.Name = "UserControl1"
>         Me.Size = New System.Drawing.Size(141, 93)
>         Me.Panel1.ResumeLayout(False)
>         Me.ResumeLayout(False)

>     End Sub

> #End Region

> #Region "Usercontrol user code"

> #End Region

>     Public WriteOnly Property SetPanelEnabledOrDisabled() As Boolean
>         Set(ByVal vblnEnablePanel As Boolean)
>             Panel1.Enabled = vblnEnablePanel
>         End Set
>     End Property

>     Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
> System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

>     End Sub
> End Class



Tue, 07 Dec 2004 03:50:49 GMT  
 enabled property of stock controls, specifically labels
Is there a simple way to cause a disabled label control to look like
the label on a disabled checkbox?  When you disable a checkbox, the
associated label appears with the 3D gray text, but when you disable a
label control, it appears with flat gray text.


Sat, 25 Dec 2004 05:27:36 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Transparent Control (specifically the Label and Button control)

2. ***anyone used Timer control RTSenable property to enable rs485 transmitter?***

3. enabled property of textbox control

4. TabStop, TabIndex property on a Label control

5. Help/Examples on DataRepeater control (specifically data bound combobox)

6. How to read a label control properties

7. MSChart control, problem setting text properties of labels......

8. Pass Label control through a Property Set statement

9. Any tab controls specifically for VB5?

10. Allowing the user to data enter Label control's Caption property

11. how to use stock page info feed my own stock ticker

12. Pass Label control through a Property Set statement

 

 
Powered by phpBB® Forum Software