dotNet中怎行实现 BitBlt 功能就是位图考贝

解决方案 »

  1.   

    API[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
    private static extern bool BitBlt(
    IntPtr hdcDest,
    int nXDest,
    int nYDest,
    int nWidth,
    int nHeight,
    IntPtr hdcSrc,
    int nXSrc,
    int nYSrc,
    System.Int32 dwRop
    );
      

  2.   

    写过一个,代码在http://community.csdn.net/Expert/topic/3810/3810268.xml?temp=.5839197
      

  3.   

    to:Firestone2003(笨笨小猪)dotNet Framework 没有实现这功能吗?
      

  4.   

    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private 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 LongPrivate Sub Command1_Click()
    Dim wScreen As Long
    Dim hScreen As Long
    Dim w As Long
    Dim h As Long
    Picture1.ClswScreen = BarCode1.Width
    hScreen = BarCode1.Height - 10Picture1.ScaleMode = vbPixels
    w = Picture1.ScaleWidth
    h = Picture1.ScaleHeight
     
    hdcScreen = GetDC(0)r = StretchBlt(Picture1.hdc, 0, 0, w, h, hdcScreen, BarCode1.Left + Me.Left \ Screen.TwipsPerPixelX + 3, BarCode1.Top + Me.Top \ Screen.TwipsPerPixelY + 30, wScreen, hScreen, vbSrcCopy)End SubPrivate Sub Command2_Click()
      SavePicture Picture1.Image, "d:\tmp\tmp.jpg"     '将条形码保存为图像文件以便打印
    End Sub
     
    Private Sub Form_Load()
     Picture1.Width = BarCode1.Width
     Picture1.Height = BarCode1.Height
     End SubPrivate Sub Text1_Change()
    BarCode1.Value = Text1.Text
    End Sub