女人心不狠站不稳小说:vb学习积累

来源:百度文库 编辑:偶看新闻 时间:2024/04/28 19:15:45

1.将文本框的MultiLine属性设为True,ScrollBars属性设为3-Both或者1和2。(出现文本滚动

条)

2.VB的Label不支持滚动条,如果你希望显示多页文字,应该使用TextBox控件。 设置TextBox的

MultiLine属性为True,ScrollBar属性为2,有垂直滚动条,并设置其Locked属性为True则可(这

样用户不能修改内容)。

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("您确认要退出系统么?", 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