Kalet的技术文档 Kalet的技术文档,涉及.NET、Andriod、Arduino、Python的软件开发,所有资料均从网络复制,版权归原著者所有。

VB.Net My.Resource的使用方法

 

在右侧Resources中一共保存有一个.wav的声音文件和一个.ico的图标文件,以下代码演示如何调用Resources中的文件资源

Public Class Form1

    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        Dim s As String = My.Resources.ExitHint

        If (MsgBox(s, MsgBoxStyle.YesNo) = MsgBoxResult.No) Then
            e.Cancel = True
        End If
    End Sub

'更多vb.net源代码和实例,请关注乐博网lob.cn

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Icon = My.Resources.Icon1
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        My.Computer.Audio.Play(My.Resources.ding, AudioPlayMode.Background)
    End Sub
End Class

作者:Iva    来源:乐博网收集

Tags: VB VB.NET

发布: Kalet 分类: VB、VB.NET 评论: 0 浏览: 134
留言列表