惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 奇远

网络记事本 用google检索email 读注册表 - 奇远 - 博客园 Crystal Report 部署 读写xml - 奇远 - 博客园 vb.net发邮件 - 奇远 - 博客园 VB.NET程序只能启动一次 - 奇远 - 博客园 dataset遍历表中的数据 - 奇远 - 博客园 vb.net自定义纸张大小 - 奇远 - 博客园 怎样使用水晶报表的推模式? SQL查询语句精华使用简要 vb.net事务处理 各种连接字符串设置 CREATE PROCEDURE 将数字串转换为中文金额字符串 中文转换成拼音函数 运行时动态添加和删除控件 VB类Class设计 VB读写注册表
按钮控件数组
奇远 · 2007-04-05 · via 博客园 - 奇远

Public Class ButtonArray
    Inherits System.Collections.CollectionBase

    Private ReadOnly HostForm As System.Windows.Forms.Form

    '创建类的构造函数。
    ' Visual Basic
    Public Sub New(ByVal host As System.Windows.Forms.Form)
        HostForm = host
        'Me.AddNewButton()
    End Sub

    Public Sub AddNewButton() '?AddHandler aButton.Click, AddressOf ClickHandler


        ' 创建 Button 类的新实例。
        Dim aButton As New System.Windows.Forms.Button
        ' 将按钮添加到集合的内部列表。
        Me.List.Add(aButton)
        ' 将按钮添加到由 HostForm 字段
        ' 引用的窗体的控件集合中。
        HostForm.Controls.Add(aButton)
        ' 设置按钮对象的初始属性。
        aButton.Top = Count * 25
        aButton.Left = 100
        aButton.Tag = Me.Count
        aButton.Text = "按钮 " & Me.Count.ToString


        '将事件与事件处理程序相关联
        AddHandler aButton.Click, AddressOf ClickHandler
    End Sub


    '公开控件数组

    Default Public ReadOnly Property Item(ByVal Index As Integer) As _
   System.Windows.Forms.Button
        Get
            Return CType(Me.List.Item(Index), System.Windows.Forms.Button)
        End Get
    End Property


    Public Sub Remove()
        ' 检查以确保存在要删除的按钮。
        If Me.Count > 0 Then
            ' 从宿主窗体控件集合中删除添加到数组
            ' 的最后一个按钮。请注意在访问数组时
            ' 默认属性的使用。
            HostForm.Controls.Remove(Me(Me.Count - 1))
            Me.List.RemoveAt(Me.Count - 1)
        End If
    End Sub


    '创建公共事件处理程序
    Public Sub ClickHandler(ByVal sender As Object, ByVal e As _
   System.EventArgs)
        MessageBox.Show("您已单击按钮 " & CType(CType(sender, _
           Button).Tag, String))
    End Sub