VB跪求png透明图片控件
不要给我链接让我自己去下不要给我API代码,我不需要只要能加载png透明图片的控件,重谢!先给100分,满意再加100...
不要给我链接让我自己去下
不要给我API代码,我不需要
只要能加载png透明图片的控件,重谢!
先给100分,满意再加100 展开
不要给我API代码,我不需要
只要能加载png透明图片的控件,重谢!
先给100分,满意再加100 展开
5个回答
展开全部
你不自搭消颂已下还别人桥前给你知郑邮去么。
追问
用不了啊!你怎么测试通过的?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我也想用图片透明控件,但是弄了半天还无效。。。。
累死我了
累死我了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'模块
Option Explicit
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
Public Function loadpicture(Display As Object, path As String) As Long
Dim pImg As Long, pGraphics As Long, w As Long, h As Long, StartupInput As GdiplusStartupInput, I As Integer
StartupInput.GdiplusVersion = 1
If GdiplusStartup(pImg, StartupInput, ByVal 0) Then loadpicture = 0: Exit Function Else loadpicture = 1
Call GdipLoadImageFromFile(StrConv(path, vbUnicode), pImg)
Call GdipCreateFromHDC(Display.hDC, pGraphics)
Call GdipGetImageWidth(pImg, w)
Call GdipGetImageHeight(pImg, h)
Display.Width = w * 15
Display.Height = h * 15
Display.Refresh
Call GdipCreateFromHDC(Display.hDC, pGraphics)
Call GdipDrawImageRect(pGraphics, pImg, 0, 0, w, h)
Call GdipDisposeImage(pImg)
Call GdipDeleteGraphics(pGraphics)
Call GdiplusShutdown(pImg)
End Function
'窗体
Private Sub Command1_Click()
Call loadpicture(Picture1, "C:\Users\Administrator\Desktop\2.png")
End Sub
Option Explicit
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
Public Function loadpicture(Display As Object, path As String) As Long
Dim pImg As Long, pGraphics As Long, w As Long, h As Long, StartupInput As GdiplusStartupInput, I As Integer
StartupInput.GdiplusVersion = 1
If GdiplusStartup(pImg, StartupInput, ByVal 0) Then loadpicture = 0: Exit Function Else loadpicture = 1
Call GdipLoadImageFromFile(StrConv(path, vbUnicode), pImg)
Call GdipCreateFromHDC(Display.hDC, pGraphics)
Call GdipGetImageWidth(pImg, w)
Call GdipGetImageHeight(pImg, h)
Display.Width = w * 15
Display.Height = h * 15
Display.Refresh
Call GdipCreateFromHDC(Display.hDC, pGraphics)
Call GdipDrawImageRect(pGraphics, pImg, 0, 0, w, h)
Call GdipDisposeImage(pImg)
Call GdipDeleteGraphics(pGraphics)
Call GdiplusShutdown(pImg)
End Function
'窗体
Private Sub Command1_Click()
Call loadpicture(Picture1, "C:\Users\Administrator\Desktop\2.png")
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
那就用 裁切工具 把周围一圈白边切掉吧~\r\n
追问
怎么用啊?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |