VB跪求png透明图片控件

不要给我链接让我自己去下不要给我API代码,我不需要只要能加载png透明图片的控件,重谢!先给100分,满意再加100... 不要给我链接让我自己去下

不要给我API代码,我不需要
只要能加载png透明图片的控件,重谢!
先给100分,满意再加100
展开
 我来答
popmoon
推荐于2016-12-05 · TA获得超过9993个赞
知道大有可为答主
回答量:4464
采纳率:30%
帮助的人:3520万
展开全部

试下这个,备锋睁银很好用,包括测仿早晌试代码

追问
看图片还有点白边啊!
哥们,有时间没有,帮忙优化一下吧。
只要从外部导入png图片到控件内就可以了,别的功能都不用!
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友6ad756714
2015-01-22 · TA获得超过1525个赞
知道大有可为答主
回答量:1940
采纳率:71%
帮助的人:697万
展开全部

你不自搭消颂已下还别人桥前给你知郑邮去么。

追问
用不了啊!你怎么测试通过的?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
OFITSER40FONT
2017-10-25
知道答主
回答量:2
采纳率:0%
帮助的人:1099
展开全部
我也想用图片透明控件,但是弄了半天还无效。。。。
累死我了
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
彩艺观影厅
2021-11-24
知道答主
回答量:12
采纳率:0%
帮助的人:2656
展开全部
'模块
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
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
xi...u@163.com
2015-01-22 · 超过48用户采纳过TA的回答
知道答主
回答量:74
采纳率:0%
帮助的人:89.2万
展开全部
那就用 裁切工具 把周围一圈白边切掉吧~\r\n
追问
怎么用啊?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 3条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式