| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 956 人关注过本帖, 1 人收藏
标题:在图片框中显示该图片(如果图片大小超过图片框,用滚动条控制显示)。
只看楼主 加入收藏
wangtuan7788
Rank: 1
等 级:新手上路
帖 子:286
专家分:0
注 册:2007-10-8
收藏(1)
 问题点数:0 回复次数:1 
在图片框中显示该图片(如果图片大小超过图片框,用滚动条控制显示)。
在图片框中显示图片(如果图片大小超过图片框,用滚动条控制显示)。
这个怎么弄啊?
搜索更多相关主题的帖子: 图片框 图片大小 滚动 
2008-01-08 09:43
dawn4640576
Rank: 1
等 级:新手上路
帖 子:1079
专家分:0
注 册:2007-9-19
收藏
得分:0 
不清楚.不过你可以直接调用打开图片的程序打开这个图片.用shell
如:
Shell "C:\WINDOWS\system32\mspaint.exe c:\1.bmp", vbMaximizedFocus
===================================================================
下面这个是将一个图片缩小成90*120的代码.
你可以先把图片缩小成合适的大小,然后再显示.
希望对你有用.

Private   Declare   Function   StretchBlt   Lib   "gdi32"   (ByVal   hdc   As   Long,   ByVal   x   As   Long,   ByVal   y   As   Long,   ByVal   nWidth   As   Long,   ByVal   nHeight   As   Long,   ByVal   hSrcDC   As   Long,   ByVal   xSrc   As   Long,   ByVal   ySrc   As   Long,   ByVal   nSrcWidth   As   Long,   ByVal   nSrcHeight   As   Long,   ByVal   dwRop   As   Long)   As   Long   
  Private   Declare   Function   SetStretchBltMode   Lib   "gdi32"   (ByVal   hdc   As   Long,   ByVal   nStretchMode   As   Long)   As   Long   
   
  Const   HALFTONE   =   4   
   
  Private   Sub   Command1_Click()   
  On   Error   Resume   Next   
  CommonDialog1.ShowOpen   
  If   CommonDialog1.FileName   <>   ""   Then   
        Picture1.Picture   =   LoadPicture(CommonDialog1.FileName)   
  End   If   
  End   Sub   
   
  Private   Sub   Command2_Click()   
  Picture2.Cls   
  SetStretchBltMode   Picture2.hdc,   HALFTONE   
  StretchBlt   Picture2.hdc,   0,   0,   90,   120,   Picture1.hdc,   0,   0,   Picture1.ScaleWidth,   Picture1.ScaleHeight,   vbSrcCopy   
  End   Sub   
   
  Private   Sub   Command3_Click()   
  On   Error   Resume   Next   
  CommonDialog1.ShowSave   
  If   CommonDialog1.FileName   <>   ""   Then   
      SavePicture   Picture2.Image,   CommonDialog1.FileName   
  End   If   
  End   Sub   
   
  Private   Sub   Form_Load()   
  Picture1.ScaleMode   =   3   
  Picture1.AutoSize   =   True   
  Picture1.AutoRedraw   =   True   
  Picture2.AutoRedraw   =   True   
  Picture2.ScaleMode   =   3   
  Command1.Caption   =   "打开图片"   
  Command2.Caption   =   "转换"   
  Command3.Caption   =   "保存"   
  End   Sub

我看青山多妩媚料青山看我应如是
2008-01-08 11:24
快速回复:在图片框中显示该图片(如果图片大小超过图片框,用滚动条控制显示)。 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014091 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved