求教Stretchblt函数的用法,谢谢各位大侠小侠!

解决方案 »

  1.   

    BOOL StretchBlt(    HDC hdcDest, // handle of destination device context 
        int nXOriginDest, // x-coordinate of upper-left corner of dest. rect. 
        int nYOriginDest, // y-coordinate of upper-left corner of dest. rect. 
        int nWidthDest, // width of destination rectangle 
        int nHeightDest, // height of destination rectangle 
        HDC hdcSrc, // handle of source device context 
        int nXOriginSrc, // x-coordinate of upper-left corner of source rectangle 
        int nYOriginSrc, // y-coordinate of upper-left corner of source rectangle 
        int nWidthSrc, // width of source rectangle 
        int nHeightSrc, // height of source rectangle 
        DWORD dwRop  // raster operation code 
       );
      

  2.   

    這個API是將一個位圖擴充為指定大小的位圖  Stretchblt(目標.Canvas.Handle, 0, 0, 目標.Width,
        目標.Height, 源.Canvas.Handle, 0, 0, 源.Width,
        源.Height,
        SRCCOPY);
      

  3.   

    Public Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) 
    As Long
    数值 说明
    BLACKNESS 用黑色填充目标矩形
    DSTINVERT 逆转目标矩形
    MERGECOPY 用AND运算合并图案与源矩形
    MERGEPAINT 用"或"运算合并源矩形的反与目标矩形
    NOTSRCERASE 复制源矩形的逆矩形到目标中
    PATCOPY 用"或"运算合并源矩形和目标矩形求反
    PATINVERT 将图案复制到目标矩形
    PATPAINT 用XOR运算组合图案和目标矩形
    用或运算组合源矩形的反与图案颜色,并将结果用或运算组合目标矩形
    SRLAND 用AND运算组合源和目标矩形
    SRCCOPY 复制源矩形到目标矩形
    SRCERASE 将目标矩形的逆用AND运算与源矩形组合
    SRCINVERT 用XOR运算组合源矩形和目标矩形
    SRCPAINT 用或运算组合源和目标矩形
    WHITENESS 用白色填充目标矩形VB的……
      

  4.   

    倒,恰好我有个例子,procedure StretchImage(_bitmap: TBitmap; _Image: TImage; _size : Integer; _RealWidth: Integer; _RealHeight: Integer);   //放大缩小图片
    var
      tempbitmap: TBitmap;
    begin
      tempbitmap:=TBitmap.Create;
      _Image.Width:=_RealWidth * _size div 100;
      _Image.Height:=_RealHeight * _size div 100;
      tempbitmap.Width:=_Image.Width;
      tempbitmap.Height:=_Image.Height;
      stretchblt(tempbitmap.Canvas.Handle,0,0,_Image.Width,_Image.Height,_bitmap.Canvas.Handle,0,0,_bitmap.Width,_bitmap.Height,SRCCOPY);
      _Image.Picture.Bitmap.Assign(tempbitmap);
      tempbitmap.Destroy;
    end;