不能超过32767(16位有符号整形的最大值——2^15-1)最好把ScaleMode设为vbPixels
可以参考这个程序的滚动条:
http://zyl910vb.51.net/vb/other/BigText.htm右击连接,目标另存为
注意把下载后的*.zip.jpg改名成*.zip
可以参考这个程序的滚动条:
http://zyl910vb.51.net/vb/other/BigText.htm右击连接,目标另存为
注意把下载后的*.zip.jpg改名成*.zip
“picturebox2.top = -vscroll1.value * 2 + 240
结果当滚动条移动到某个位置的时候报“实时错误 6 溢出”。”
picturebox2.top 的最大取值应当是245745
此处报错是因为vscroll1.value最大为+ - 32767 你可以:
picturebox2.top = -Clng(vscroll1.value) * 2 + 240
你可以将窗体、Picture1,picture2的ScaleMode属性都设为3(Pixel)就不会溢出了,变更后如下:
picturebox1.top = 480 / Screen.TwipsPerPixelY
picturebox1.left = 0
picturebox1.height = 8500 / Screen.TwipsPerPixelY
picturebox1.width = 10000 / Screen.TwipsPerPixelX
picturebox2.top = 240 / Screen.TwipsPerPixelY
picturebox2.left = 120 / Screen.TwipsPerPixelX
picturebox2.height = 90000 / Screen.TwipsPerPixelY
picturebox2.width = 8000 / Screen.TwipsPerPixelX
picturebox2.autosize = true
当vscroll1发生change()的时候语句如下:
picturebox2.top = (-vscroll1.value + 240) / Screen.TwipsPerPixelY
逛荡:
picturebox2.top = -Clng(vscroll1.value) * 2 + 240使用无效!
再问:pixels是相对长度单位还是绝对长度单位?
VB默认的单位是缇(Twip)
一般屏幕 1pixel = 15Twips
具体可根据 水平(Screen.TwipsPerPixelX) 或垂直 (Screen.TwipsPerPixelY)得到每一像素中的缇数。