当前位置: 网学 > 编程文档 > VB > 正文

透明方式叠加图象

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/16
下载{$ArticleTitle}原创论文样式

    透明叠加方式是图象处理中常用的一种处理方式,在这种处理方式中,一幅图片叠加到另
一幅图片上,但是这幅图象不是完全将原来的图象覆盖,而是能够部分的透过叠加的图象显示
出来,下面我就介绍如何在VB中编程实现这样的功能。
    首先在建立两个大小相等的图象文件,将它们保存成BMP文件,VB5以上的版本支
持JPEG显示,也可以保存为Jpg文件。在Form中加入两个PictureBox控件,将它们的大小设置成
同图象文件相同的大小。注意这两个PictureBox控件不要相互重叠,也不要和Form中的其它控件
产生重叠。将两幅图象分别加入到两个PictureBox控件中。然后在Form中加入一个CommandButton
控件。最后在Form的代码窗口中加入以下代码:

Private Type LOGBRUSH
        lbStyle As Long
        lbColor As Long
        lbHatch As Long
End Type
Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type

Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal _
        hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) _
        As Long
Private Declare Function CreateCompatibleDC 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 FillRect Lib "user32" (ByVal hdc As Long, _
        lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC 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 dwRop As Long) As Long
Private Declare Function CreateBrushIndirect Lib "gdi32" (lpLogBrush _
        As LOGBRUSH) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long

Const SRCPAINT = &HEE0086
Const SRCAND = &H8800C6
Const BS_SOLID = 0
Const gColor = &HFFFFFF

Private Sub Command1_Click()
    Dim pDstDC As Long
    Dim dcCompatible As Long
    Dim pBitmapOld As Long
    Dim bm As Long
    Dim rectTemp As RECT
    Dim lBrush As Long
    Dim tLog As LOGBRUSH
     
   &nbs
  • 下一篇资讯: 五彩缤纷的清屏效果
  • 网学推荐

    免费论文

    原创论文

    浏览:
    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
    湘ICP备09003080号