说明下方法(代码以后可以贴下): 
在窗体出现前用BitBlt将屏幕图片贴在一个PictureBox控件, 再半透明地贴到Form里, 差不多是这样的了

解决方案 »

  1.   


    MS 在自己的系统里都没实现,所以在98下很难!还是找2K吧。
      

  2.   

    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    Private Const WS_EX_LAYERED = &H80000
    Private Const GWL_EXSTYLE = (-20)
    Private Const LWA_ALPHA = &H2
    Private Const LWA_COLORKEY = &H1Private Sub Command1_Click()
    Dim i As Byte
    Dim rtn As Long
    i = 128
    rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
    rtn = rtn Or WS_EX_LAYERED
    SetWindowLong me.hwnd, GWL_EXSTYLE, rtn
    SetLayeredWindowAttributes me.hwnd, 0, i, LWA_ALPHA'i决定透明度
    '当i=0时窗口全透明,i=128时窗口半透明,i=255时窗口不透明
    End Sub
      

  3.   

    在form中建3个picturebox,一个commandbutton
    点击窗体即变透明'首先要将form的borderstyle设为0Sub ShowTransparency(cSrc As PictureBox, cDest As PictureBox, _
        ByVal nLevel As Byte)
        Dim LrProps As rBlendProps
        Dim LnBlendPtr As Long
        
        'cDest.Cls
        LrProps.tBlendAmount = nLevel
        CopyMemory LnBlendPtr, LrProps, 4
        With cSrc
            AlphaBlend cDest.hdc, 0, 0, .ScaleWidth, .ScaleHeight, _
                .hdc, 0, 0, .ScaleWidth, .ScaleHeight, LnBlendPtr
        End With
        cDest.Refresh
    End SubPrivate Sub Command1_Click()
    '将窗体存为位图
    Picture1.Width = Me.Width
    Picture1.Height = Me.Height
    BitBlt Picture1.hdc, 0, 0, Me.Width, Me.Height, Me.hdc, 0, 0, vbSrcCopy
    Picture1.Refresh
    '获得窗体背后的图象
    Picture3.Width = Me.Width
    Picture3.Height = Me.Height
    BitBlt Picture3.hdc, 0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY, Picture2.hdc, Me.Left / Screen.TwipsPerPixelX, Me.Top / Screen.TwipsPerPixelY, vbSrcCopy
    Picture3.Refresh
    '透明化
    ShowTransparency Picture3, Picture1, 100
    End SubPrivate Sub Form_Load()
    Picture1.Visible = True
    Picture1.AutoRedraw = True
    Picture1.BorderStyle = 0
    Picture1.Appearance = 0
    Picture1.Top = 0
    Picture1.Left = 0
    Picture2.Visible = False
    Picture2.AutoRedraw = True
    Picture2.Appearance = 0
    Picture2.BorderStyle = 0
    Picture3.Visible = False
    Picture3.AutoRedraw = True
    Picture3.BorderStyle = 0
    Picture3.Appearance = 0
        
        Dim DeskHdc&, Ret&    ' 首先先捕获桌面
        DeskHdc = GetDC(0)
        
        Picture2.Width = Screen.Width
        Picture2.Height = Screen.Height
        BitBlt Picture2.hdc, 0, 0, Picture2.Width / Screen.TwipsPerPixelX, Picture2.Height / Screen.TwipsPerPixelY, DeskHdc, 0, 0, vbSrcCopy
        Ret = ReleaseDC(0&, DeskHdc)
        Picture2.Refresh
        
    End Sub下面copy在模块中
    Public Type rBlendProps
        tBlendOp As Byte
        tBlendOptions As Byte
        tBlendAmount As Byte
        tAlphaType As Byte
    End TypePublic Declare Function AlphaBlend Lib "msimg32" (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 widthSrc As Long, _
            ByVal heightSrc As Long, ByVal blendFunct As Long) As BooleanPublic Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
            (Destination As Any, Source As Any, ByVal Length As Long)Public 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
    Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Public Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
    Public Const SRCCOPY = &HCC0020
      

  4.   

    我刚刚在win98第二版、vb6下通过的
      

  5.   

    用dengwei007(邓蔚)讲的方法
    可以实现背景是静态的半透明
    动态的无法实现其实微软都没有把Win98下的半透明编出来
    大家都知道,拖动文件的时候,文件的图标是半透明的
    如果你把桌面背景设为一动态Gif,再拖动桌面的图标,你会发现桌面背景的那幅动态Gif停止运动了
      

  6.   

    win98下面实现窗体透明本来就很难,最多就是需要的时候(窗体不动时)将它变成透明,动时再恢复正常嘛
      

  7.   

    大家辛苦了,这样看来在WIN98下是真的根本无法实现了,谢谢大家