Newsgroup: it.comp.lang.visual-basic
Titolo: Creare una Evento MouseDown

Salve vorrei sapere se qualche d'uno mi puo aiutare
------------
Sto creando una griglia dove visualizzare uno sotto l'altro dei dati:
Adesso vi spiego cosa sto facendo e di cosa ho bisogno:
Ho creato su un form
Su questo Form ho messo un panel in cui dentro questo pannell  verra creata 
una specie di griglia creata dimanicamente da dei controlli:
Ho creato Form chiamato Form1
Ho creatu un Pannel (panel1) creato sul form 1
poi ho creato una classe che creera una specie di griglia:
---------
Public Class Class1'----
Dim Hp As Integer = 30
Dim Hs As Integer = 33
Dim Index As Integer = 0
'----
Sub New()
For i = 0 To 3
'-----
Dim NewPanle As New Panel
'-----
If i = 0 Then
NewPanle = DirectCast(CreaControlliPanel(0, Hs, i + 1), Panel)
'--------- Aggiungiamo il PannelloGriglia al PannelloForm
Form1.Panel1.Controls.Add(NewPanle)
AddHandler NewPanle.MouseDown, AddressOf MyEventClic
'---------
Else
'--------- Creamo in Nuovo Pannello e facciamo il cast
NewPanle = DirectCast(CreaControlliPanel(Hp, Hs, i + 1), Panel)
'--------- Aggiungiamo il PannelloGriglia al PannelloForm
Form1.Panel1.Controls.Add(NewPanle)
AddHandler NewPanle.MouseDown, AddressOf MyEventClic
'---------
Hp += 30
'---------
End If
Next
End Sub
Function CreaControlliPanel(ByVal HPanel As Integer, ByVal HSize As Integer, 
ByVal Index As Integer) As Panel
'----
Dim PnlGriglia As New Panel
Dim LblIndex As New Label
Dim LblImg As New Label
Dim LblTitleKey, LblKeyFrn As New Label
Dim LblTitleNomeForn, LblNomeForn As New Label
Dim LblCatMerci As New Label
'************ Pannello Griglia
'---- Griglia
PnlGriglia.Location = New Point(5, HPanel)
PnlGriglia.Size = New Size(562, 33)
PnlGriglia.BorderStyle = BorderStyle.FixedSingle
PnlGriglia.Tag = Index
'************* Elementi Grliglia Pannlo
'---- : LabIndex
With LblIndex
.Location = New Point(0, 0)
.Size = New Size(34, 31)
.TextAlign = ContentAlignment.MiddleCenter
.Text = Index
.Tag = Index
'.BorderStyle = BorderStyle.FixedSingle
End With
'---- : LabImage
With LblImg
.Location = New Point(35, 0)
.Size = New Size(140, 31)
.ImageList = Form1.ImageList1
.ImageIndex = 3
.TextAlign = ContentAlignment.MiddleCenter
.ImageAlign = ContentAlignment.MiddleCenter
.Tag = Index
'.Text = ""
'.BorderStyle = BorderStyle.FixedSingle
End With
'---- : LabTitleKey. LblTitleNomeForn
With LblTitleKey
.Location = New Point(176, 1)
.Size = New Size(75, 15)
.TextAlign = ContentAlignment.MiddleLeft
.Text = "Key Fornitore:"
.Tag = Index
'.BorderStyle = BorderStyle.FixedSingle
End With
With LblTitleNomeForn
.Location = New Point(176, 16)
.Size = New Size(75, 15)
.TextAlign = ContentAlignment.MiddleLeft
.Text = "Rag.Sociale:"
.Tag = Index
'.BorderStyle = BorderStyle.FixedSingle
End With
'---- : LabKeyForn, LblNomeForn
With LblKeyFrn
.Location = New Point(252, 0)
.Size = New Size(69, 15)
.TextAlign = ContentAlignment.MiddleLeft
.Text = ".........:"
.Tag = Index
'.BorderStyle = BorderStyle.FixedSingle
End With
With LblNomeForn
.Location = New Point(252, 16)
.Size = New Size(285, 15)
.TextAlign = ContentAlignment.MiddleLeft
.Text = ".................."
.Tag = Index
'.BorderStyle = BorderStyle.FixedSingle
End With
'---- : LblCatMerci
With LblCatMerci
.Location = New Point(322, 0)
.Size = New Size(215, 15)
.TextAlign = ContentAlignment.MiddleLeft
.Text = ".................."
.Tag = Index
'.BorderStyle = BorderStyle.FixedSingle
End With
'************ Aggiungiamo i Controlli Sul Pannello Griglia
With PnlGriglia.Controls
.Add(LblIndex)
.Add(LblImg)
.Add(LblTitleKey)
.Add(LblKeyFrn)
.Add(LblTitleNomeForn)
.Add(LblNomeForn)
.Add(LblCatMerci)
End With
'-------
Return PnlGriglia
'-------
End Function

Scusate ma ho sbagliato e inserire il messaggio