如题!可以实现多张图转场过渡的控件!

解决方案 »

  1.   

    不是吧?有朋友建议我找控件,而你又建议我写代码!
    我写过代码,但是不太符合我的要求,或是我有点解决不了的难题!
    那就是:
    图片要居中显示,大小不变,不要让图片去符合控件!如果图片超出screen,则按比例缩小!如果能解决这个问题,我可以提供200分!
      

  2.   

    图片要居中显示,大小不变,不要让图片去符合控件!如果图片超出screen,则按比例缩小
    =============================================================================
    最先用If语句判断图片大小是否超过屏幕
    再进行计算一下坐标
    效果不就出来了
      

  3.   

    居中的坐标计算:
    Left=(ScreenWidth-Width)/2
    Top=(ScreenHeight-Height)/2
    很简单嘛
      

  4.   

    StretchBlt
    这么简单,你朋友被控件惯坏了??
      

  5.   

    我倒,那些问题我还是知道的,OK!是我没有说清楚!
    我现在用的是bitblt函数来做一个类似屏保的东西!现在的问题是在用bitblt时,图片我可以让它居中,但是不能完全的复制掉!
    附代码!
    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
    Const SRCCOPY = &HCC0020
    Const bmpfilemax = 10000&
    Dim bmpfile(bmpfilemax) As String
    Dim drawbmpmode(bmpfilemax) As Integer
    Dim bmpnum, movestep, xmax, ymax, filenum As Integer
    Dim kxy As Single
    Dim PICW, PICH, pict, picl, sum As IntegerPrivate Sub Form_Click()
        Unload Me
    End SubPrivate Sub Form_Load()
        Me.Top = 0
        Me.Left = 0
        Me.Height = Screen.Height
        Me.Width = Screen.Width
        Set con = New ADODB.Connection
        Set rec = New ADODB.Recordset
        con.Open "provider=Microsoft.jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Jet OLEDB"
        rec.CursorLocation = adUseClient
        sql = "select * from [mod_jt_yj] where img<>''"
        rec.Open sql, con, 1, 3
        bmpnum = 0
        filenum = 0
        Do While Not rec.EOF
            bmpfile(filenum) = rec("img")
            drawbmpmode(filenum) = Int((3) * Rnd + 1)
            filenum = filenum + 1
            rec.MoveNext
        Loop
        movestep = 0
        xmax = (wxyjll.ScaleWidth - Picture1.Width) / 2
        ymax = wxyjll.ScaleHeight / 2
        kxy = ymax / xmax
        Picture1.Picture = LoadPicture(bmpfile(bmpnum))
        Picture1.PaintPicture LoadPicture(bmpfile(bmpnum)), 0, 0, Picture1.Width, Picture1.Height
        Timer1.Interval = 20
        Label1.Visible = False
    End SubPrivate Sub Picture1_Click()
        Unload Me
    End SubPrivate Sub Timer1_Timer()
        hDestDC = wxyjll.HDC
        hSrcDC = Picture1.HDC
        drawflag = drawbmpmode(bmpnum)
        Select Case drawflag
            Case 1
                endmax = xmax
                X1 = xmax - movestep
                w = movestep * 2
                Y1 = CInt(ymax - movestep * kxy)
                h = CInt(2 * movestep * kxy)
                i = BitBlt(hDestDC, (Me.ScaleWidth - Picture1.ScaleWidth) / 2 + X1, (Me.ScaleHeight - Picture1.ScaleHeight) / 2 + Y1, w, h, hSrcDC, X1, Y1, SRCCOPY)
            Case 2
                endmax = xmax
                w = movestep * 2
                h = wxyjll.ScaleHeight
                i = BitBlt(hDestDC, (Me.ScaleWidth - Picture1.ScaleWidth) / 2, (Me.ScaleHeight - Picture1.ScaleHeight) / 2, w, h, hSrcDC, X1, Y1, SRCCOPY)
            Case 4
                endmax = xmax
                w = movestep
                h = wxyjll.ScaleHeight
                i = BitBlt(hDestDC, (Me.ScaleWidth - Picture1.ScaleWidth) / 2, (Me.ScaleHeight - Picture1.ScaleHeight) / 2, w, h, hSrcDC, 0, 0, SRCCOPY)
                X1 = wxyjll.ScaleWidth - movestep
                i = BitBlt(hDestDC, (Me.ScaleWidth - Picture1.ScaleWidth) / 2 + X1, (Me.ScaleHeight - Picture1.ScaleHeight) / 2, w, h, hSrcDC, X1, 0, SRCCOPY)
            Case 3
                endmax = CInt(2 * xmax / 10)
                tempi = CInt(2 * xmax / 10)
                w = movestep
                h = wxyjll.ScaleHeight
                For ij = 0 To 9
                    i = BitBlt(hDestDC, (Me.ScaleWidth - Picture1.ScaleWidth) / 2 + tempi * ij, (Me.ScaleHeight - Picture1.ScaleHeight) / 2, w, h, hSrcDC, tempi * ij, 0, SRCCOPY)
                Next ij
            End Select
        wxyjll.Refresh
        movestep = movestep + 2
        If movestep > endmax Then
            PICW = Picture1.Width
            PICH = Picture1.Height
            bmpnum = bmpnum + 1
            If bmpnum >= rec.RecordCount And Label1.Caption = "true" Then
                bmpnum = 0
            ElseIf Label1.Caption = "false" And bmpnum >= rec.RecordCount Then
                Unload Me
            End If
            movestep = 0
            Picture1.Picture = LoadPicture(bmpfile(bmpnum))
            Picture1.PaintPicture LoadPicture(bmpfile(bmpnum)), 0, 0, Picture1.Width, Picture1.Height
        End If
    End Sub