一劳永逸让VB自动改变控件大小 Private Sub Form_Load()//初始化设置   Picture1.AutoSize = True   Command1.Caption = ″显示网格″   Command2.Caption = ″取消网格″   Form1.Caption = ″显示网格图像演示程序″   End Sub   ----------------   Private Sub Form_Activate()//设置网格颜色   Picture1.ForeColor = vbWhite   Picture1.Move 0, 0   End Sub   ----------------   Private Sub Command1_Click()//显示网格   Dim HLINESNUM As Integer   Dim WLINESNUM As Integer   Dim XX As Integer   Dim I As Integer   Dim J As Integer   Dim YY As Integer   HLINESNUM = 15 //设置网格为15*15显示   WLINESNUM = 15   Picture1.Refresh   Picture1.AutoRedraw = False   XX = Int(Picture1.ScaleWidth / WLINESNUM)   YY = Int(Picture1.ScaleHeight / HLINESNUM)   For I = 1 To HLINESNUM + 1   Picture1.Line (XX * I, 0)-(XX * I, Picture1.Height - 1)   Picture1.Line (0, YY * I)-(Picture1.Width - 1, YY * I)   Next   End Sub   ------------   Private Sub Command2_Click()//取消网格   Picture1.AutoRedraw = False   Picture1.Refresh   End Sub   ------------   Private Sub Form_Unload(Cancel As Integer)   Unload Me //结束程序   End   End Sub
2021-11-21 16:03:55 1KB vblistview
1