VB는 PNG 이미지를 표시합니다(투명 창과 일반 창에 적합함).
Private Declare Function GdiplusStartup Lib "gdiplus" (token As Long, inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As Long = 0) As GpStatus
Private Declare Sub GdiplusShutdown Lib "gdiplus" (ByVal token As Long)
Private Declare Function GdipCreateFromHDC Lib "gdiplus" (ByVal hwnd As Long, graphics As Long) As GpStatus
Private Declare Function GdipDeleteGraphics Lib "gdiplus" (ByVal graphics As Long) As GpStatus
Private Declare Function GdipDrawImageRect Lib "gdiplus" (ByVal graphics As Long, ByVal image As Long, ByVal x As Single, ByVal y As Single, ByVal Width As Single, ByVal Height As Single) As GpStatus
Private Declare Function GdipLoadImageFromFile Lib "gdiplus" (ByVal filename As String, image As Long) As GpStatus
Private Declare Function GdipGetImageWidth Lib "gdiplus" (ByVal image As Long, Width As Long) As GpStatus
Private Declare Function GdipGetImageHeight Lib "gdiplus" (ByVal image As Long, Height As Long) As GpStatus
Private Declare Function GdipDisposeImage Lib "gdiplus" (ByVal image As Long) As GpStatus
Private Type GdiplusStartupInput
GdiplusVersion As Long
DebugEventCallback As Long
SuppressBackgroundThread As Long
SuppressExternalCodecs As Long
End Type
Private Enum GpStatus
Ok = 0
GenericError = 1
InvalidParameter = 2
OutOfMemory = 3
ObjectBusy = 4
InsufficientBuffer = 5
NotImplemented = 6
Win32Error = 7
WrongState = 8
Aborted = 9
FileNotFound = 10
ValueOverflow = 11
AccessDenied = 12
UnknownImageFormat = 13
FontFamilyNotFound = 14
FontStyleNotFound = 15
NotTrueTypeFont = 16
UnsupportedGdiplusVersion = 17
GdiplusNotInitialized = 18
PropertyNotFound = 19
PropertyNotSupported = 20
End Enum
' .
Private Const c_pngPath As String = "1.png" ' 。
Dim m_token As Long
Private Sub Form_paint()
Dim pImg As Long
Dim pGraphics As Long
Dim w As Long, h As Long
Call GdipCreateFromHDC(Me.hDC, pGraphics)
Call GdipLoadImageFromFile(StrConv(c_pngPath, vbUnicode), pImg)
Call GdipGetImageWidth(pImg, w)
Call GdipGetImageHeight(pImg, h)
Call GdipDrawImageRect(pGraphics, pImg, 0, 0, w, h)
Call GdipDisposeImage(pImg)
Call GdipDeleteGraphics(pGraphics)
End Sub
Private Sub Form_Load()
Dim StartupInput As GdiplusStartupInput
StartupInput.GdiplusVersion = 1
If GdiplusStartup(m_token, StartupInput, ByVal 0) Then
MsgBox "Error initializing GDI+"
Exit Sub
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call GdiplusShutdown(m_token)
End Sub
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Access Request, Session and Application in Struts2If we want to use request, Session and application in JSP, what should we do? We can obtain Map type objects such as Req...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.