使用图片框和下一个按钮移动图片

时间:2015-11-17 09:21:37

标签: vb.net button

我是初级水平的学习者使用VB,目前我正在尝试创建两个按钮,这将允许我滑过在线文件夹中的图片。我需要某种方法来更改URL中的图像编号,以便按钮可以让我在图片中移动。

<Style x:Key="varietyListViewItemStyle" TargetType="ListViewItem">
    <Setter Property="MinWidth" Value="0" />
    <Setter Property="MinHeight" Value="0" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ListViewItem">
                <ListViewItemPresenter 
                    Foreground="#979797"
                    Background="#ffffff"
                    SelectedForeground="#ffffff"
                    SelectedBackground="#fd8c00" 
                    PressedBackground="#fd8c00"
                    SelectedPressedBackground="#fd8c00"
                    SelectedPointerOverBackground="#fd8c00"
                    Margin="20"
                    />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

1 个答案:

答案 0 :(得分:0)

试试这个,请注意private变量。

Private _CurrentImage as Int32 = 1
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    CurrentImage += 1
    Dim pb1 As dispImg
    pb1 = New dispImg()
    pb1.picBox = PictureBox10
    pb1.load(string.format("http://aipot.wowspace.org/imageapix.php?uid=iti2015&folderid=71&img={0}&key=xxxxx",_CurrentImage ))
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
    CurrentImage += 1
    Dim pb1 As dispImg
    pb1 = New dispImg()
    pb1.picBox = PictureBox10
    pb1.loadstring.format("http://aipot.wowspace.org/imageapix.php?uid=iti2015&folderid=71&img={0}&key=xxxxx",_CurrentImage )))
End Sub

我假设Button4是PREVIOUS而Button5是NEXT。你需要做一些工作来防止数字超出范围,但是你可以看到递增/递减数字然后将它填入字符串是多么容易。