FlowLayoutPanel滚动到图片框并专注于它

时间:2018-02-07 02:24:04

标签: vb.net select scroll focus flowlayoutpanel

我有一个FlowLayoutPanel,我使用此代码填充了Picture Box:

    If Me.cbDisplayThumbnails.Checked then
    ' Displaying thumbnails of the images
    Me.picBox.Visible = False
    Me.thumbNailPanel.Controls.Clear
    Me.thumbNailPanel.Visible = True  
    For i As Integer = 0 to bmpList.Count-1
        Dim picViewer As New PictureBox
        picViewer.Image = bmpList(i)
        picViewer.SizeMode = PictureBoxSizeMode.Zoom
        picViewer.Dock = DockStyle.Bottom
        picViewer.Height = 300
        picViewer.Width = 300
        picViewer.Name = i.ToString
        AddHandler picViewer.Click, AddressOf thumbnail_Click
        Me.thumbNailPanel.Controls.Add(picViewer)
    Next
    Exit Sub 
End If

然后,我想根据面板控件集合中的索引关注其中一个图片框。这是我尝试过的:

            Me.thumbNailPanel.Enabled = True
            Me.thumbNailPanel.Controls(thePage).Focus

我也试过了     Me.thumbNailPanel.Controls(翻动书页)。选择 和     Me.thumbNailPanel.ScrollControlIntoView(Me.thumbNailPanel.Controls(翻动书页)

都没有工作。

我有AutoScroll = True。面板中有64个图片框。我想让面板向下滚动到所选的图片框并专注于它。

0 个答案:

没有答案