包含vb.net数组事件的词条
在VB.net里定义的控件数组怎么定义事件
Imports System.Text
创新互联公司是一家专业提供和静企业网站建设,专注与做网站、网站设计、H5高端网站建设、小程序制作等业务。10年已为和静众多企业、政府机构等服务。创新互联专业网站设计公司优惠进行中。
Imports System.Windows
Imports System.Windows.Forms
Public Class Netin '类 名
'Inherits Forms.Form
Public Shared Netin As New Form
Public components As ComponentModel.IContainer
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
DebuggerStepThrough()
Public Sub InitializeComponent()
Me.components = New ComponentModel.Container()
Dim resources As ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(bjt))
Me.TextBox1 = New TextBox(Me.components)
Me.Button1 = New Button(Me.components)
'For … Next
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.m = New ContextMenuStrip(Me.components)
Me.m1.Text = "菜单项1"
'设置并添加相关控件,(窗体)Netin 初始化。
End Sub
Private Sub Form_Load(sender As Object, e As EventArgs) Handles Me.Load
'加载后显示窗体Netin。
End Sub
Public Sub ObjClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click,Button2.Click,Button3.Click,TextBox1.Click
MessageBox.Show("你按了鼠标")
End Sub
Public WithEvents TextBox1 As TextBox
Public WithEvents Button1 As Button
Public WithEvents Button2 As Button
Public WithEvents Button3 As Button
Friend WithEvents m As ContextMenuStrip
Friend WithEvents m1 As ToolStripMenuItem
End Class
Class MainWindow
Netin.Show()
Netin.Button2.Text = "Main"
……
求大神指点 vb.net 用代码添加的数组图片框控件.怎么添加单击控件事件呢? 单击放大在单击就还原
.....
Px += 0
Py += 20
AddHandler pic(i).Click, AddressOf Pic_Click '添加这一句,绑定单击图片框事件
Next
FlowLayoutPanel1.Controls.AddRange(pic)
End Sub
Dim l As Point, s As Size, f As Boolean
Private Sub Pic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim pic As PictureBox = CType(sender, PictureBox)
If f Then
pic.Location = l
pic.Size = s
f = False
Else
l = pic.Location
s = pic.Size
pic.BringToFront()
pic.Location = FlowLayoutPanel1.Location
pic.Size = FlowLayoutPanel1.Size
f = True
End If
End Sub
vb.net中定义控件数组,控件数组中加入多个按钮。怎么能在控件数组事件响应对应按钮的事件,代码部分:
Dim bt As New ArrayList
bt.Add(Me.Button5)
bt.Add(Me.Button6)
bt.Add(Me.Button7)
上面这段代码本人表示不懂,故没有使用。下面的代码在VS2015中运行通过:
Private Sub btClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click, Button6.Click, Button7.Click
Select Case CType(sender, Button).Name
Case "Button5"
MessageBox.Show("你点击了 Button5 按钮")
Case "Button6"
MessageBox.Show("你点击了 Button6 按钮")
Case "Button7"
MessageBox.Show("你点击了 Button7 按钮")
End Select
End Sub
网页标题:包含vb.net数组事件的词条
URL分享:http://myzitong.com/article/dopegop.html