是否可以在运行模式下在1个图片框上显示多个图像

时间:2013-06-26 08:51:23

标签: vb6

当我尝试谷歌3天时,我发现在1个picbox中只有1张图片/图片。我的目标是显示多个图像,它们不能重叠。如果它们重叠,则应显示红色。

我正在使用VB6。我正在使用1 combobox1,用于选择图像n 1命令。但是当我在点击按钮中选择第二张图像时,picbox上的图像会自动覆盖它。它是由.cls ??

引起的
Private Sub Combo1_Click()
Dim pin As String
Dim intx As Integer
If UCase$(Combo1.List(intx)) = UCase$(pin) Then
Combo1.ListIndex = intx
End If
End Sub
Private Sub Command1_Click()

If Combo1.ListIndex = 0 Then
Set mPic = pin8.Image
ElseIf Combo1.ListIndex = 1 Then
Set mPic = pin12.Image

Else
Set mPic = pin16.Image
End If

    mPicWidth = Me.ScaleX(mPic.Width, vbHimetric, Picture1.ScaleMode)
    mPicHeight = Me.ScaleY(mPic.Height, vbHimetric, Picture1.ScaleMode)
    ShowPictureAtPosition mLeft, mTop

End Sub

谢谢。 最良好的问候, 陈

1 个答案:

答案 0 :(得分:0)

看,这样做的唯一方法是在项目中添加2个图像作为资源,然后将其中一个作为默认图片,或者根据需要将其留空。

现在的过程就是当你点击两个图片之间切换的命令按钮时。

按钮代码:

if 

PictureBox1.Image = My.Resources.<Name_of_res_file>.<Name_of_image1111_resource>

Then

PictureBox1.Image = My.Resources.<Name_of_res_file>.<Name_of_image2222_resource>

Else

PictureBox1.Image = My.Resources.<Name_of_res_file>.<Name_of_image1111_resource>

End If

这将在2张图片之间切换。希望这会对你有所帮助。

相关问题