我想用vb实现图像的压缩例如压缩为384*288
要指定高和宽的压缩才给分
分不够我可以加

解决方案 »

  1.   

    Private Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (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
      

  2.   

    把下面内容保存为TXT文件,把后缀名改为FRM,可以直接使用
    或到http://cwsoft.y365.com/图像压缩.rar 下载VERSION 5.00
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   6960
       ClientLeft      =   60
       ClientTop       =   450
       ClientWidth     =   10425
       LinkTopic       =   "Form1"
       ScaleHeight     =   464
       ScaleMode       =   3  'Pixel
       ScaleWidth      =   695
       StartUpPosition =   3  '窗口缺省
       Begin VB.CommandButton Command1 
          Caption         =   "压缩"
          Height          =   975
          Left            =   7680
          TabIndex        =   4
          Top             =   4800
          Width           =   1935
       End
       Begin VB.TextBox Text2 
          Height          =   270
          Left            =   7560
          TabIndex        =   3
          Text            =   "100"
          Top             =   960
          Width           =   1695
       End
       Begin VB.TextBox Text1 
          Height          =   270
          Left            =   7560
          TabIndex        =   2
          Text            =   "100"
          Top             =   600
          Width           =   1695
       End
       Begin VB.PictureBox Picture2 
          AutoRedraw      =   -1  'True
          AutoSize        =   -1  'True
          Height          =   2055
          Left            =   7560
          ScaleHeight     =   133
          ScaleMode       =   3  'Pixel
          ScaleWidth      =   149
          TabIndex        =   1
          Top             =   2160
          Width           =   2295
       End
       Begin VB.PictureBox Picture1 
          AutoRedraw      =   -1  'True
          AutoSize        =   -1  'True
          Height          =   6555
          Left            =   360
          Picture         =   "Form1.frx":0000
          ScaleHeight     =   433
          ScaleMode       =   3  'Pixel
          ScaleWidth      =   467
          TabIndex        =   0
          Top             =   240
          Width           =   7065
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Option Explicit
    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()
    Picture2.Width = Text1.Text
    Picture2.Height = Text2.Text
    StretchBlt Picture2.hdc, 0, 0, Val(Text1.Text), Val(Text2.Text), Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, vbSrcCopy
    Picture2.Refresh
    End Sub
      

  3.   

    laisiwei最近怎么对图像有兴趣啦?