Picturebox加载 控件后 总是看不全

Fxx 2009-02-26 11:32:19
按照传统方式 放2个picturebox 和滚动条
但是即使滚动到最后还是看不全图片
我实在是算的晕头转向了,谁有现成的
告诉一下
...全文
120 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zdingyun 2009-02-26
  • 打赏
  • 举报
回复
[Quote=引用楼主 Fxx 的帖子:]
按照传统方式 放2个picturebox 和滚动条
但是即使滚动到最后还是看不全图片
我实在是算的晕头转向了,谁有现成的
告诉一下
[/Quote]
用1个PictureBox控件,在该控件内放1个Image控件,使用下列代码,能在PictureBox控件内看到完整的图片。
Private Sub Form_Load()
Picture1.Top = 0
Picture1.Left = 0
Picture1.Height = Me.Height
Picture1.Width = Me.Width
Image1.Height = Picture1.Height
Image1.Width = Picture1.Width
Image1.Stretch = True
End Sub

Private Sub Form_Resize()
Picture1.Height = Me.Height
Picture1.Width = Me.Width
Image1.Height = Picture1.Height
Image1.Width = Picture1.Width
Image1.Stretch = True
End Sub
东方之珠 2009-02-26
  • 打赏
  • 举报
回复
http://topic.csdn.net/u/20080203/10/39c5e44b-1789-41d9-a782-cb1c34cd5382.html
东方之珠 2009-02-26
  • 打赏
  • 举报
回复
不管怎么滚动,肯定是看不全的。能否采用StretchBlt 缩放显示?
参考:http://topic.csdn.net/u/20080910/20/1ab23882-3cb0-49dc-9b86-eb169e58a823.html 里面5楼
feiyun0112 2009-02-26
  • 打赏
  • 举报
回复
为什么要这样写?
VScroll1.Max = Picture1.Height / 4
Fxx 2009-02-26
  • 打赏
  • 举报
回复
Option Explicit

Private Sub Form_Load()
Picture2.Left = 0
Picture2.Top = 0
Picture2.Width = Picture1.Width
Picture2.Height = Picture1.Height
VScroll1.Min = 0
HScroll1.Min = 0
HScroll1.Min = 0
VScroll1.Max = Picture1.Height / 4 'Picture2.Height - Picture1.Height
HScroll1.Max = Picture1.Width / 4 'Picture2.Width - Picture1.Width
If HScroll1.Max < 0 Then HScroll1.Enabled = False
If VScroll1.Max < 0 Then VScroll1.Enabled = False
End Sub
Private Sub Command1_Click()
On Error GoTo ErrExit
CommonDialog1.Filter = "Bitmap file(*.bmp)|*.bmp|All File(*.*)|*.*"
CommonDialog1.FilterIndex = 1
CommonDialog1.ShowOpen
Picture2.Picture = LoadPicture(CommonDialog1.FileName)
VScroll1.Min = 0
HScroll1.Min = 0
VScroll1.Max = Picture2.Height - Picture1.Height
HScroll1.Max = Picture2.Width - Picture1.Width
If HScroll1.Max < 0 Then HScroll1.Enabled = False
If VScroll1.Max < 0 Then VScroll1.Enabled = False
ErrExit:
End Sub
Private Sub HScroll1_Change()
Picture2.Left = -HScroll1.Value
End Sub

Private Sub VScroll1_Change()
Picture2.Top = -VScroll1.Value
End Sub

feiyun0112 2009-02-26
  • 打赏
  • 举报
回复
你的代码?

*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)

http://feiyun0112.cnblogs.com/
Fxx 2009-02-26
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 zdingyun 的回复:]
引用楼主 Fxx 的帖子:
按照传统方式 放2个picturebox 和滚动条
但是即使滚动到最后还是看不全图片
我实在是算的晕头转向了,谁有现成的
告诉一下

用1个PictureBox控件,在该控件内放1个Image控件,使用下列代码,能在PictureBox控件内看到完整的图片。

VB codePrivate Sub Form_Load()
Picture1.Top = 0
Picture1.Left = 0
Picture1.Height = Me.Height
Picture1.Width = Me.Width
Imag…
[/Quote]

到是给了我一个新的思路

1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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