选择一个图片大小768*576问怎么截取它的下半部分生成一个768*288的图片清晰度不变

解决方案 »

  1.   

    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
      

  2.   

    BitBlt这个API 座标与图像宽高都是以像素(Pixel)为单位的BitBlt Picture2.hDC, 0,0,768,288, Picture1.hdc, 0,288, vbSrcCopy
      

  3.   

    对,使用BitBlt函数Option Explicit
    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
    Private Sub Command1_Click()
        Dim lngP As Long
        picD.Cls
        lngP = BitBlt(picD.hDC, 0, 0, picS.Width, picS.Height / 2, picS.hDC, 0, 0, vbSrcCopy)
    End SubPrivate Sub Form_Load()
        Me.ScaleMode = 3
        With picS
            .ScaleMode = 3
            .AutoRedraw = True
        End With
        With picD
            .ScaleMode = 3
            .AutoRedraw = True
            .Width = picS.Width
            .Height = picS.Height
        End With
        picS.Picture = LoadPicture("C:\1.jpg")
    End Sub
      

  4.   

    如何将截取后的图片保存呢?下面的代码怎么不行呢?pa = App.Path & "\00.jpg"
    SavePicture Picture2.Image, pa
    Picture2里截取后的图片
      

  5.   

    SavePicture 只能保存为 .bmp 要保存为 .jpg 得用GDI 或其它控件等方法我来成都办事 回去后再给你
      

  6.   

    我身份证户籍地成都金堂 , 忘了问你是那里的 ?没办法,在浙江本地没权限办事, 只能回老家来办, 今天不能办,只能等到星期一才能办, 以后回来机会就多了.还有上次跟你说的事, 有空的话访问一下 http://vb6.asia 或 http://vbbar.com