本文主要是介绍VB学习第三周--窗体事件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
窗体事件:
1.装载窗体
2.单击窗体
3.双击窗体
4.改变了窗体大小
Public Class Form1Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ClickMe.BackgroundImageLayout = ImageLayout.Tile '以平铺方式显示窗体背景Me.BackgroundImage = Image.FromFile("background.bmp") '装入相应图片Me.Text = "单击窗体"Me.Icon = New Icon("MONITR01.ico") ' 改变窗体左上方的小图标Me.Cursor = New Cursor("KEY04.ICO") ' 鼠标指针改为指定的文件名图标Me.MaximizeBox = TrueMe.MinimizeBox = TrueEnd SubPrivate Sub Form1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DoubleClickMe.BackgroundImageLayout = ImageLayout.Stretch '以拉伸方式显示窗体背景Me.Text = "双击窗体"End SubPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadMe.BackgroundImage = Image.FromFile("PC01.ICO")Me.Text = "装载窗体"End SubPrivate Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ResizeMe.BackgroundImage = Nothing ' 卸掉图片,窗体无背景图片Me.MaximizeBox = FalseMe.MinimizeBox = FalseMe.Cursor = Cursors.Default ' 鼠标指针恢复为默认值Me.Icon = NothingMe.Text = "改变了窗体大小"End Sub
End Class
这篇关于VB学习第三周--窗体事件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!