帮我看下代码为什么错误

神功小成 2017-05-10 12:02:06
Public Class ViewEventsForm


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Call SetAutoScrollMargins()

End Sub
Private Sub SetAutoScrollMargins()
If (TextBox1.Location.X > Panel1.Location.X) Or _
(TextBox1.Location.Y > Panel1.Location.Y) Then
Panel1.AutoScroll = True
If (Panel1.AutoScrollMargin.Width < 5) Or _
(Panel1.AutoScrollMargin.Height < 5) Then
'Panel1.SetAutoScrollMargin(5, 5)
Panel1.AutoScrollMargin = Size(5, 5)
Panel1.AutoScrollMargin.Width = 5
End If
End If
End Sub
End Class

Panel1.AutoScrollMargin = Size(5, 5)
Panel1.AutoScrollMargin.Width = 5'
这两句什么错误 ,要怎样改这两句才能有用啊
...全文
278 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
im战术 2017-05-14
  • 打赏
  • 举报
回复

    Private Sub SetAutoScrollMargins()
        If (TextBox1.Location.X > Panel1.Location.X) Or
            (TextBox1.Location.Y > Panel1.Location.Y) Then
            Panel1.AutoScroll = True
            If (Panel1.AutoScrollMargin.Width < 5) Or
                (Panel1.AutoScrollMargin.Height < 5) Then
                'Panel1.SetAutoScrollMargin(5, 5)
                Panel1.AutoScrollMargin = New Size(5, 5)
                'Panel1.AutoScrollMargin.Width = 5 '这个赋值是错误的 可能作者设计时没声明好
            End If
        End If
    End Sub
xdashewan 2017-05-10
  • 打赏
  • 举报
回复
你自己不都写了吗panel1.SetAutoScrollMargin(5, 5);或者Panel1.AutoScrollMargin = new Size(5, 5);

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧