Private Sub Timer1_Timer()
    BitBlt Picture1.hDC, 98, 0, 16, 23, Picture2.hDC, 16 * Int(Mid$(Time, 8, 1)), 0, SRCCOPY
End Sub
上面的代码是按时间里的秒的多少来决定截取哪个地方的图片的,但是图片截取的图片的循序是从左到右截取Picture2里的图片的,如何让他是按从是到下的循序截取Picture2里的图片的呢?该怎么修改?

解决方案 »

  1.   

    Private Sub Timer1_Timer()
        BitBlt Picture1.hDC, 98, 0, 16, 23, Picture2.hDC, 16 * Int(Mid$(Time, 8, 1)), 0, SRCCOPY
    End Sub
    上面的代码无法测试.
      

  2.   

    这是当然的了,因为这只是很小的一段代码,还有API和定义没加进去。真的没有人知道怎么实现吗 ?
      

  3.   

    和paintpicture 差不多 按时间决定截取的高度 而且 height2 应该是从上到下的
      

  4.   

    按照picture2.hdc 的y轴绘制改成
    BitBlt Picture1.hDC, 98, 0, 16, 23, Picture2.hDC, 0,  16 * Int(Mid$(Time, 8, 1)), SRCCOPY 
      

  5.   


    下面这是横向截取的代码:
    BitBlt Picture1.hDC, 98, 0, 16, 23, Picture2.hDC, 16 * Int(Mid$(Time, 8, 1)), 0, SRCCOPY代码的所在不同之处是最后的"0"放到了中间就可以实现纵向截取,能不能告诉我这个"0"所在位置的意义呢?
      

  6.   

    BitBlt
    The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context. BOOL BitBlt(
      HDC hdcDest, // handle to destination DC
      int nXDest,  // x-coord of destination upper-left corner
      int nYDest,  // y-coord of destination upper-left corner
      int nWidth,  // width of destination rectangle
      int nHeight, // height of destination rectangle
      HDC hdcSrc,  // handle to source DC
      int nXSrc,   // x-coordinate of source upper-left corner
      int nYSrc,   // y-coordinate of source upper-left corner
      DWORD dwRop  // raster operation code
    );
    Parameters
    hdcDest 
    [in] Handle to the destination device context. 
    nXDest 
    [in] Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    nYDest 
    [in] Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle. 
    nWidth 
    [in] Specifies the width, in logical units, of the source and destination rectangles. 
    nHeight 
    [in] Specifies the height, in logical units, of the source and the destination rectangles. 
    hdcSrc 
    [in] Handle to the source device context. 
    nXSrc 
    [in] Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle. 
    nYSrc 
    [in] Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle. 
    dwRop 
    [in] Specifies a raster-operation code. These codes define how the color data for the source rectangle is to be combined with the color data for the destination rectangle to achieve the final color. 
      

  7.   

    VB声明 
    Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (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 说明 
    将一幅位图从一个设备场景复制到另一个。源和目标DC相互间必须兼容
     
    返回值 
    Long,非零表示成功,零表示失败。会设置GetLastError 参数表 
    参数                 类型及说明 
    hDestDC           Long,目标设备场景 
    x,y               Long,对目标DC中目标矩形左上角位置进行描述的那个点。用目标DC的逻辑坐标表示 
    nWidth,nHeight    Long,欲传输图象的宽度和高度 
    hSrcDC            Long,源设备场景。如光栅运算未指定源,则应设为0 
    xSrc,ySrc         Long,对源DC中源矩形左上角位置进行描述的那个点。用源DC的逻辑坐标表示 
    dwRop             Long,传输过程要执行的光栅运算 注解 
    在NT环境下,如在一次世界传输中要求在源设备场景中进行剪切或旋转处理,这个函数的执行会失败
    如目标和源DC的映射关系要求矩形中像素的大小必须在传输过程中改变,那么这个函数会根据需要自动伸缩、旋转、折叠、或切断,以便完成最终的传输过程