1.將文本框的MultiLine屬性設為True,ScrollBars屬性設為3-Both或者1和2。(出現(xiàn)文本滾動
條)
2.VB的Label不支持滾動條,如果你希望顯示多頁文字,應該使用TextBox控件。 設置TextBox的
MultiLine屬性為True,ScrollBar屬性為2,有垂直滾動條,并設置其Locked屬性為True則可(這
樣用戶不能修改內(nèi)容)。
3. 改變按鈕的文字顏色
在Form上放置一個按鈕和Picture。將Picture的Visibel設置為False。將按鈕的Style屬性設置
為1。然后使用下面的語句:
Private Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.ForeColor = vbRed
Picture1.CurrentX = Command1.Width / 2
Picture1.CurrentY = Command1.Height / 3
Picture1.Print "OK"
Command1.Caption = ""
Command1.Picture = Picture1.Image
End Sub
4. 你可以改變一下Label控件的BackStyle屬性。如果該屬性為1表示顯示背景色,如果為0表示
透明。
5. 退出
Private Sub mnuExit_Click()
Reset
End
End Sub
6.換行
Label.Caption:=‘abc‘+#13+‘def‘;
7.重新登錄
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("您確認要退出系統(tǒng)么?", vbOKCancel + vbExclamation, "警告") = vbOK Then
Unload Me
End If
End Sub
8 一個框向另一個框復值
Private Sub OKButton_Click()
frmresearch1.smscontent.Text = Text1.Text + Text2.Text + Text3.Text
Unload Me
End Sub
9
取消登錄
Private Sub CancelButton_Click()
Unload Me
End Sub
10
控制Frame在同一位置顯示與隱藏
Private Sub SSTab1_Click(PreviousTab As Integer)
Select Case SSTab1.Tab
Case 0
Frame17.Visible = True
Case 1
Frame16.Visible = True
Frame17.Visible = False
Case 2
Frame5.Visible = True
Frame16.Visible = False
Frame17.Visible = False
End Select
End Sub
11
瀏覽 文件選擇
Private Sub Command1_Click()
Load file_select
file_select.Tag = "export_val"
file_select.Show 1
End Sub
12
時間控件
Private Sub Timer1_Timer()
ProgressBar1.Value = ProgressBar1.Value + 1
If ProgressBar1.Value >= ProgressBar1.Max Then
Load Form1
Form1.Show
Unload Me
End If
End Sub