簡體   English   中英

VB6使用粘貼中的引用轉換為Jpeg

[英]VB6 converting to Jpeg with references from a paste

我正在嘗試將圖片粘貼到應用程序中,然后立即將其從位圖轉換為jpeg。 我以前曾使用過它,但是隨后對於某些將使用該應用程序的計算機,Microsoft Image Acquisition dll是不可能的。 我找到修改它的代碼來做到這一點:

如果Clipboard.GetFormat(vbCFMetafile)或Clipboard.GetFormat(vbCFBitmap),則strFileName = Format(Now,“ ddhhmmss”)

    If Clipboard.GetFormat(vbCFMetafile) Then
        SavePicture Clipboard.GetData(vbCFMetafile), strTemp & "\" & strFileName & ".bmp"
    Else
        Dim bm As Bitmap
        bm = Clipboard.GetData(vbCFBitmap)
        bm.Save strTemp & "\" & strFileName & ".jpg", System.Drawing.Imaging.ImageFormat.Jpg

    End If
    'UPLOAD to the DB

End If

但是,當我運行該應用程序時,它說未在“ System.Drawing.Imaging.ImageFormat.Jpg”上定義的變量,但我嘗試了Imaging.ImageFormat.Jpg和Drawing.Imaging.ImageFormat.Jpg的不同組合,但無濟於事。在項目->引用“ System.Drawing.dll”下,但是我不知道在這種情況下是否必須導入它或在其他地方定義它。

有誰知道我怎樣才能使這段代碼起作用,或者我有更好的方式進行這種轉換?

通過使用此鏈接中的代碼能夠解決我自己的問題: http : //www.vbforums.com/showthread.php? 694045-RESOLVED-Bitmap-to-GIF

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM