1、设计窗体窗体为标志label3稍僚敉视个;按钮button3个;文本域textbox2个;并为响应的组件设置tooltip工具提示。背景图片一张,使用loadpicture()函数载入图片设就女蒿鸳置图片自动填满,label背景为空,即0。Private Sub UserForm_Activate()Image1.Visible = TrueImage1.Picture = LoadPicture("C:\Users\jyjh\Desktop\main.jpg")Image1.AutoSize = FalseImage1.PictureSizeMode = fmPictureSizeModeStretchLabel1.BackStyle = 0Label2.BackStyle = 0Label3.BackStyle = 0End Sub
2、设置按钮功能Private Sub CommandButton1_Click()If TextBox1.Text = "admin媪青怍牙" And TextBox2.Text = "123" ThenUserForm1.HideApplication.Visible = TrueMsgBox "Login_successfully! "ElseMsgBox "Error,please try again!"End IfPrivate Sub CommandButton2_Click()ThisWorkbook.CloseEnd Subpassword文本域设置为passwchar *用于隐藏输入字符。
3、模拟打开登录: