Verify if you press Crtl inside the MouseEnter Vb.net 2010

0

Good morning, this is a windows application created in visual basic .net 2010.

I am looking for a way to be able to verify if the person is pressing the control key when it passes over some panels that I have created.

I need the verification to be done in this way because if this is correct I want to change the color to the panels as I go over them.

Panels are created at runtime and there are many. I show you the code:

For i = 0 To cantidadpaneles - 1
        Dim Panel1 = New System.Windows.Forms.Panel()
        Panel1.Location = New System.Drawing.Point(0, posalto) ' el 11 se mantiene. 
        Panel1.Name = "Panel" + numeronombre.ToString


        Panel1.Size = New System.Drawing.Size(1800, 23) '854
        Panel1.BackColor = Color.Gainsboro


        AddHandler Panel1.Click, AddressOf Panel_Click
        AddHandler Panel1.MouseEnter, AddressOf Panel_MouseEnter  'cambia de color cuando te posicionas con el mause
        AddHandler Panel1.MouseLeave, AddressOf Panel_MouseLeave  'vuelve a su color normal cuando sacas el mause
        AddHandler Panel1.KeyPress, AddressOf Panel_KeyPress
        AddHandler Panel1.KeyDown, AddressOf Panel_KeyDown
        AddHandler Panel1.MouseDown, AddressOf Panel_MouseDown
        AddHandler Panel1.MouseMove, AddressOf Panel_MouseMove



        Panel1.ContextMenuStrip = ContextMenuStrip1

        Matriz(i, 0) = Panel1.Name 'agrego a la matriz todos los paneles (nombre)
        Matriz(i, 3) = i    'guardo el nro del panel en la matriz 
        Matriz(i, 4) = posalto    'guardo la posicion en la que se crea el panel

        Me.PanelContenedor.Controls.Add(Panel1)
        posalto = posalto + 23
        numeronombre = numeronombre + 1
    Next

I did not find a way to ask if you press the control inside the mouseEnter, but maybe some idea happens to you.

    
asked by Mauro 15.03.2018 в 03:11
source

1 answer

0

'You have to Create an Event Panel_MouseMove to make the color change of this style ...

Private Sub MiFuncion(sender As Object, e As EventArgs) Handles Panel1.MosueMove
' Aquí instrucciones para hacer-le el cambio de color
End Sub
    
answered by 31.05.2018 в 23:57