用VB6.0随便编辑一个程序!

要有详细的操作步骤!
越详细越好!还追加分!
我给个实例吧
用VB6.0做一个倒记时的程序
[email protected]

VB制作图片浏览器

当我们在设置屏幕背景图,或是在你的文件中插入图片时,总要在你的电脑里选择图片。有时打开的图片你不一定满意,你又不得不一个个地打开、关闭……这样一而再,再而三地重复。如果是“Photoshop”这样的大软件运行起来更是慢得不得了。不但烦躁,而且还浪费了你很多宝贵时间。这时,你是不是觉得“电脑”有点像“猪脑”呢?不过,别急!幸好我用VB编了一个小小的程序,可以解决这个问题,你不妨试试!

下面分步设置各控件的属性:

1.设置窗体的Caption属性为“图片浏览器”,BorderStyle属性为3,即窗体大小不能改变。

2.设置Label1的属性为“当前驱动器”,Label2的属性为“当前目录”,Label3的属性为“当前文件”;Label4的属性为“当前图像”,Label5的属性为“当前文件路径”。

3.设置Text1的Text属性为空。

4.设置Image1的Stretch属性为True,即所装入的图形能够缩放以适应图像框大小。

5.设置Command1的Caption属性为“确定”,Command2的Caption属性为“退出”。

具体的程序源代码如下:

' Private Sub Command1_Click()
' Image1.Picture = LoadPicture(Text1.Text) '当单击"确定"时,文本框中的文件在图像框中显示出来
' End Sub

' Private Sub Command2_Click() '当单击"退出"时,弹出是否退出系统对话框
' Dim exi As String
' exi = MsgBox("您真的想退出吗?", vbYesNo + vbQuestion + vbDefaultButton1, "退出")
' If exi = vbYes Then
' End
' End If
' End Sub

Private Sub Dir1_Change()
File1.Path = Dir1 '当目录发生变化时,文件列表框中的文件也相应变化
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1 '当驱动器变化时,目录列表也相应变化
End Sub

Private Sub File1_Click()
Text1.Text = File1.Path + "\" + File1 '用来在文本框中显示被选中的图形名
Image1.Picture = LoadPicture(File1.Path + "\" + File1)
End Sub

' Private Sub File1_DblClick()
' Image1.Picture = LoadPicture(File1.Path + "\" + File1) '当双击文件列表中的文件时,文件在图像框中显示出来
' End Sub

Private Sub Form_Load()
' Command1.Enabled = False '在未选择图形文件时"确定"按钮不可用
File1.Pattern = "*.bmp;*.jpg;*.ico;*.cur" '在文件列表框中显示扩展名为.BMP、.JPG、.ICO、.CUR的文件
' File1.Path = "C:\Documents and Settings\All Users\Documents\My Pictures\示例图片"
End Sub

Private Sub Text1_Change()
' Command1.Enabled = True '当文本框中的内容变化时使"确定"按钮可用
End Sub

好了,按“F5”键运行一下吧!你还满意吗?通过这个小小的程序,希望广大初学VB的读者能从本文中受到小小的启发,然后能用VB 6.0编出自己的绝妙佳作。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2007-06-26
那好吧
这样OK?

Private Sub Command1_Clcik()
If Text1.Text <> "1" And Text1.Text <> "2" Then'如果TEXT1的内容不是1也不是2.
Text1.text = "1"'那么TEXT1的内容变成1
Exit Sub '退出SUB过程
End If
If Text1.Text = "1" Then'如果TEXT1的内容是1.
Text1.Text = "2"'那么TEXT1的内容编程2
Exit Sub '退出SUB过程
End If
If Text1.Text = "2" Then'如果TEXT1的内容是2.
Text1.Text = "1"'那么TEXT1的内容变成1
Exit Sub '退出SUB过程
End If
End Sub
第2个回答  2007-06-27
本程序模拟北京奥运会倒计时,
根据你设定的北京奥运会开幕时间,
与当前的时间进行计算,计算出剩余
的天数,小时数,分钟数与秒数,并显
示在窗口上.

邮件已经发到你的邮箱.
第3个回答  2007-06-27
http://hi.baidu.com/yhpp521
邮箱留下,我给你发个
第4个回答  2007-06-30
选我的!!!!!!!!!!!!!!!!!!推箱子
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

ox = nx: oy = ny
Select Case KeyCode
Case vbKeyRight
r = 1
Case vbKeyLeft
r = 3
Case vbKeyUp
r = 2
Case vbKeyDown
r = 4
Case Else
Exit Sub
End Select

nx = ox + mx(r): ny = oy + my(r)

If ps(nx, ny) = 1 Then nx = ox: ny = oy
a = ox + (oy - 1) * 8: b = nx + (ny - 1) * 8
If ps(nx, ny) = 0 Or ps(nx, ny) = 2 Then
Image10(a).Picture = Image4.Picture
If ps(nx, ny) = 2 Then
Image10(b).Picture = Image6(r).Picture
Else: Image10(b).Picture = Image5(r).Picture
End If
ps(ox, oy) = 0: ps(nx, ny) = 5
End If

If ps(nx, ny) = 3 Then
bx = nx + mx(r): By = ny + my(r)
If ps(bx, By) = 1 Or ps(bx, By) = 3 Then
nx = ox: ny = oy
Else
If (ps(bx, By) = 0 Or ps(bx, By) = 2) Then
c = bx + (By - 1) * 8
Image10(a).Picture = Image4.Picture
Image10(b).Picture = Image5(r).Picture

If ps(bx, By) = 0 Then
Image10(c).Picture = Image3.Picture
ps(ox, oy) = 0: ps(nx, ny) = 5: ps(bx, By) = 3
End If

If ps(bx, By) = 2 Then
Image10(c).Picture = Image9.Picture
ps(ox, oy) = 0: ps(nx, ny) = 5: ps(bx, By) = 3
End If
End If
End If
End If

flag = 0

For w = 1 To obn
If ps(obx(w), oby(w)) = 3 Then flag = flag + 1
If flag = obn Then
MsgBox "胜利!完成任务!!", vbOKOnly + vbApplicationModale, "胜利!!"
msg = vbCancel
z = z + 1
If z = 5 Then End
init
End If
If ps(ox, oy) = 0 And (ox = obx(w) And oy = oby(w)) Then
Image10(ox + (oy - 1) * 8).Picture = Image2.Picture
ps(ox, oy) = 2
End If
Next w
If msg = vbCancel Then Exit Sub

End Sub

Private Sub Form_Load()
Open "f:\vbp\DATA1.txt" For Input As #1
For z = 1 To 5
For y = 1 To 8
Line Input #1, da
For x = 1 To 8
db(z, x, y) = Val(Mid(da, x, 1))
Next x
Next y
Next z
z = 1
init
For y = 1 To 8
For x = 1 To 8
ps(x, y) = db(z, x, y)
Next x
Next y

For x = 1 To 8
For y = 1 To 8
a = x + (y - 1) * 8
If ps(x, y) = 1 Then Image10(a).Picture = Image1.Picture
If ps(x, y) = 2 Then Image10(a).Picture = Image2.Picture
If ps(x, y) = 3 Then Image10(a).Picture = Image3.Picture
If ps(x, y) = 0 Then Image10(a).Picture = Image4.Picture
If ps(x, y) = 5 Then
Image10(a).Picture = Image5(r).Picture
nx = x: ny = y
End If

Next y
Next x

mx(1) = 1: mx(3) = -1: my(2) = -1: my(4) = 1

End Sub

Private Sub init()
obn = 0
For x = 1 To 8
For y = 1 To 8
ps(x, y) = db(z, x, y)
a = x + (y - 1) * 8
If ps(x, y) = 1 Then Image10(a).Picture = Image1.Picture
If ps(x, y) = 2 Then
Image10(a).Picture = Image2.Picture
obn = obn + 1
obx(obn) = x: oby(obn) = y
End If
If ps(x, y) = 3 Then Image10(a).Picture = Image3.Picture
If ps(x, y) = 0 Then Image10(a).Picture = Image4.Picture
If ps(x, y) = 5 Then
Image10(a).Picture = Image5(r).Picture
nx = x: ny = y
End If

Next y
Next x
End Sub

Private Sub jsyx_Click()
End
End Sub

Private Sub n_Click()
z = 1
init
End Sub

Private Sub writer_Click()
MsgBox "程序制作:XXX E-mail:_________@yahoo.com.cn", vbOKOnly + vbApplicationModale, "作者版权"
msg = vbCancel
End Sub
第5个回答  2007-07-05
我先把程序给你发过去
如果感觉可以
再给你源码
相似回答