我知道用savepicture 保存图象,可是保存后BMP图象的象素大小,也就是画布怎么调呀,帮帮忙吧,谢谢了.

解决方案 »

  1.   

    你什么意思,你是不是想查看某个bitmap文件的信息
    可以用cDIBSection Class 
    Private Type BITMAPINFOHEADER '40 bytes 
        biSize As Long 
        biWidth As Long 
        biHeight As Long 
        biPlanes As Integer 
        biBitCount As Integer 
        biCompression As Long 
        biSizeImage As Long 
        biXPelsPerMeter As Long 
        biYPelsPerMeter As Long 
        biClrUsed As Long 
        biClrImportant As Long 
    End Type 
    Private Type BITMAPINFO 
        bmiHeader As BITMAPINFOHEADER 
        bmiColors As RGBQUAD 
    End Type 
    下载地址
    http://www.vbaccelerator.com/codelib/gfx/cdibsect.zip
    使用Private Sub Fade( _ 
        ByRef cTo As cDIBSection, _ 
        ByVal lAmount As Long _ 
        ) 
    Dim bDib() As Byte 
    Dim x As Long, y As Long 
    Dim xMax As Long, yMax As Long 
    Dim lB As Long, lG As Long, lR As Long 
    Dim lA As Long, lA2 As Long 
    Dim lTIme As Long 
    Dim tSA As SAFEARRAY2D 
        
        ' have the local matrix point to bitmap pixels 
        With tSA 
            .cbElements = 1 
            .cDims = 2 
            .Bounds(0).lLbound = 0 
            .Bounds(0).cElements = cTo.Height 
            .Bounds(1).lLbound = 0 
            .Bounds(1).cElements = cTo.BytesPerScanLine 
            .pvData = cTo.DIBSectionBitsPtr 
        End With 
        CopyMemory ByVal VarPtrArray(bDib), VarPtr(tSA), 4 
            
        yMax = cTo.Height - 1 
        xMax = cTo.Width - 1 
        
        For x = 0 To (xMax * 3) Step 3 
            For y = 0 To yMax 
                lB = lAmount * bDib(x, y) \ 255 
                lG = lAmount * bDib(x + 1, y) \ 255 
                lR = lAmount * bDib(x + 2, y) \ 255 
                bDib(x, y) = lB 
                bDib(x + 1, y) = lG 
                bDib(x + 2, y) = lR 
            Next y 
        Next x     CopyMemory ByVal VarPtrArray(bDib), 0&, 4 
        
    End Sub 
    Private Sub Command1_Click() Dim cDib As New cDibSection 
    Dim cDibBuffer as New cDibSection 
    Dim i As Long     ' Load the picture to fade: 
        Set sPic = LoadPicture("Put Your File Here!") 
        cDib.CreateFromPicture sPic     ' Create a copy of it: 
        cDibBuffer.Create cDib.Width, cDib.Height 
        cDib.PaintPicture cDibBuffer.HDC     ' Fade Loop: 
        For i = 0 To 255 Step 4 
            ' Fade the dib by amount i: 
            Fade cDib, i 
            ' Draw it: 
            cDib.PaintPicture Form1.hDC 
            ' Breathe a little. You may have to put a slowdown here: 
            DoEvents 
            ' Reset for next fade: 
            cDibBuffer.PaintPicture cDib.HDC 
        Next i End Sub