且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

向动态面板添加鼠标处理程序

更新时间:2023-12-04 09:38:40

to完成此操作:

(以其中一个标签为例)
to complete this :
(by the example of one of these Labels)
With newLabel_Name
.Name = "Label_dyna_Name" + ID
.Font = New System.Drawing.Font("Tahoma", 7.25!, System.Drawing.FontStyle.Bold)
.Text = Name.ToUpper
.Dock = DockStyle.Fill
.TextAlign = ContentAlignment.BottomRight
.Size = New System.Drawing.Size(0, 13)
.ForeColor = Color.White

.Parent = panel ' replaces the panel.Controls.Add(newLabel_Name)

.AddHandler .MouseDown, AddressOf DynaPanel_MouseDown
End With





但注意:

处理Panel时,manuel创建的Handler不会自动删除。为此,你必须通过自己的Dispose-Method(或Detach-Method)删除它。



But Attention :
This manuel created Handler is not removed automaticly when disposing the Panel. For this you MUST remove it by your own Dispose-Method (or Detach-Method).