看到一个范例是用PSet的,但是那样太慢了,图像大一点的话就会死机

解决方案 »

  1.   

    我也只看到过那个例子,确实很慢,再找找吧,既然Windows默然的浏览器能转,就说明需要调用这个浏览器的某个功能,也就是它调用了什么函数,你也应该调用什么函数.
      

  2.   

    'moudel
    Option ExplicitPrivate Declare Function PlgBlt Lib "gdi32" (ByVal hdcDest As Long, _
                                                                            lpPoint As POINTS2D, _
                                                                            ByVal hdcSrc As Long, _
                                                                            ByVal nXSrc As Long, _
                                                                            ByVal nYSrc As Long, _
                                                                            ByVal nWidth As Long, _
                                                                            ByVal nHeight As Long, _
                                                                            ByVal hbmMask As Long, _
                                                                            ByVal xMask As Long, _
                                                                            ByVal yMask As Long) As LongPrivate Const NotPI = 3.14 / 180Private Type POINTS2D
          X   As Long
          Y   As Long
    End Type'图像的旋转
    Function PictureRotate(ByRef picDestHdc As Long, xPos As Long, yPos As Long, ByVal Angle As Long, ByRef picSrcHdc As Long, srcXoffset As Long, srcYoffset As Long, ByVal SrcWidth As Long, ByVal SrcHeight As Long)
     'picDestHdc目标图像设备场景
     'xPos,yPos旋转点
     'Angle旋转角度
    ' picSrcHdc ---------  Long,图象的源设备场景
    '
    '  srcXoffset,srcYoffset ----  Long,源图象左上角的x,y坐标,采用逻辑坐标系统表示
    '
    '  srcWidth,srcHeight -  Long,源图象大小,用逻辑坐标表示
                      Dim Points(3)     As POINTS2D
                      Dim DefPoints(3)     As POINTS2D
                      Dim ThetS     As Single, ThetC       As Single
                      Dim ret     As Long
                      On Error GoTo Lhandle
                      'SET   LOCAL   AXIS   /   ALIGNMENT                  Points(0).X = 0
                      Points(0).Y = -0
           
                      Points(1).X = Points(0).X + SrcWidth
                      Points(1).Y = Points(0).Y
           
                      Points(2).X = Points(0).X
                      Points(2).Y = Points(0).Y + SrcHeight
                   
                      'ROTATE   AROUND   Z-AXIS
                      ThetS = Sin(Angle * NotPI)
                      ThetC = Cos(Angle * NotPI)
                      
                      DefPoints(0).X = (Points(0).X - xPos) * ThetC - (Points(0).Y - yPos) * ThetS + xPos
                      DefPoints(0).Y = (Points(0).Y - yPos) * ThetC + (Points(0).X - xPos) * ThetS + yPos
                   
                      DefPoints(1).X = (Points(1).X - xPos) * ThetC - (Points(1).Y - yPos) * ThetS + xPos
                      DefPoints(1).Y = (Points(1).Y - yPos) * ThetC + (Points(1).X - xPos) * ThetS + yPos
                   
                      DefPoints(2).X = (Points(2).X - xPos) * ThetC - (Points(2).Y - yPos) * ThetS + xPos
                      DefPoints(2).Y = (Points(2).Y - yPos) * ThetC + (Points(2).X - xPos) * ThetS + yPos
                   
                      PlgBlt picDestHdc, DefPoints(0), picSrcHdc, srcXoffset, srcYoffset, SrcWidth, SrcHeight, 0, 0, 0
                      Exit Function
    Lhandle:
                  MsgBox ("Error!")
    End Function
    'form
    Private Sub Command1_Click()
    Picture2.Cls
    PictureRotate Picture2.hDC, Picture1.ScaleWidth / 2, Picture1.ScaleHeight / 2, Int(360 * Rnd), Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
    Picture2.Refresh
    End Sub
      

  3.   

    这是我收藏的代码,在picture1中加一张图片
      

  4.   

    怎么没有运行啊
    PictureRotate Picture2.hDC, Picture1.ScaleWidth / 2, Picture1.ScaleHeight / 2, Int(360 * Rnd), Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
     上面这句执行了的啊,我单步跟踪了
      

  5.   

    picture的autoredraw属性要设为true