| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2778 人关注过本帖, 1 人收藏
标题:请教Form中的picture属性添加图片的问题
只看楼主 加入收藏
kingsir007
Rank: 1
等 级:新手上路
帖 子:6
专家分:7
注 册:2010-4-22
结帖率:100%
收藏(1)
已结贴  问题点数:5 回复次数:5 
请教Form中的picture属性添加图片的问题

问一下大家,FORM中的picture属性添加了图片,图片什么样自动调整大小和窗体的大小一致
可用分不多大家见谅
谢谢
搜索更多相关主题的帖子: picture Form 属性 
2010-05-25 14:51
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:1 
你和 yuk_yu 是一个学校,一个年级的吗 ?

自己看吧
https://bbs.bccn.net/thread-307800-1-1.html




授人于鱼,不如授人于渔
早已停用QQ了
2010-05-25 14:58
kingsir007
Rank: 1
等 级:新手上路
帖 子:6
专家分:7
注 册:2010-4-22
收藏
得分:0 
我问的是form的属性不是有个picture属性,这个的设置,没有用到image时
2010-05-29 00:43
bczgvip
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:66
帖 子:1310
专家分:5312
注 册:2009-2-26
收藏
得分:4 
程序代码:
Option Explicit
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 CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
Private mPic As StdPicture, px&, py&
Private mMemDC As Long
Private Sub Form_Load()
    Me.ScaleMode = vbPixels
   
    Set mPic = LoadPicture("D:\My Documents\My Pictures\头像.gif")
    px& = Me.ScaleX(mPic.Width, ScaleModeConstants.vbHimetric, vbPixels)
    py& = Me.ScaleY(mPic.Height, ScaleModeConstants.vbHimetric, vbPixels)
    mMemDC = CreateCompatibleDC(Me.hdc)
    Debug.Print mMemDC, px, py
End Sub

Private Sub Form_Paint()
    Dim hBmpTmp&
    hBmpTmp& = SelectObject(mMemDC, mPic.Handle)
    StretchBlt Me.hdc, 0, 0, Me.ScaleWidth, Me.ScaleHeight, _
        mMemDC, 0, 0, px&, py&, vbSrcCopy
    Call SelectObject(mMemDC, hBmpTmp&)
End Sub

Private Sub Form_Resize()
    If IsIconic(Me.hwnd) Then
    Else
    Form_Paint
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    DeleteDC mMemDC
End Sub
2010-05-29 06:50
yuk_yu
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:334
专家分:134
注 册:2009-3-16
收藏
得分:0 
回复 4楼 bczgvip
太棒了,学习,向版主致敬!!!
2010-05-29 08:49
kingsir007
Rank: 1
等 级:新手上路
帖 子:6
专家分:7
注 册:2010-4-22
收藏
得分:0 
谢谢,帮忙,挺复杂的
2010-05-29 19:39
快速回复:请教Form中的picture属性添加图片的问题
数据加载中...
 
   



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

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