![]() ![]() LoadIcon is a wrapper around LoadImage, and neither one can load PNGs.If you follow the instructions in the answer, youll see what theyre actually doing is copying the PNG image into an icon using the Visual Studio icon editor. Private Declare Function TranslateColor Lib "oleAut32. bobobobo That answer is wrong, or at least very misleading. Private Declare PtrSafe Function OleCreatePictureIndirect Lib "oleaut32" (PicDesc As PICTDESC, RefIID As GUID, ByVal fPictureOwnsHandle As Long, iPic As IPicture) As Long Its been pretty good so far, but the problem is I cant get to load texture from file to backbuffer with transparent background color. Private Declare PtrSafe Sub GdiplusShutdown Lib "gdiplus" (ByVal token As LongPtr) Recently Ive picked up a book and started to learn game programming with Direct3D and DirectX. Private Declare PtrSafe Function GdipDisposeImage Lib "gdiplus" (ByVal Image As LongPtr) As Long Private Declare PtrSafe Function GdipCreateHBITMAPFromBitmap Lib "gdiplus" (ByVal BITMAP As LongPtr, hbmReturn As LongPtr, ByVal background As LongPtr) As Long Private Declare PtrSafe Function GdipCreateBitmapFromFile Lib "gdiplus" (ByVal FILENAME As LongPtr, BITMAP As LongPtr) As Long Private Declare PtrSafe Function GdiplusStartup Lib "gdiplus" (token As LongPtr, inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As LongPtr = 0) As Long Private Declare PtrSafe Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long Private Declare PtrSafe Function TranslateColor Lib "oleAut32.dll" Alias "OleTranslateColor" (ByVal clr As OLE_COLOR, ByVal palet As LongPtr, Col As Long) As Long OleCreatePictureIndirect uPicInfo, IID_IDispatch, True, IPic Public Function ConvertToIPicture(ByVal hPic As Long) As IPicture Set LoadImage = ConvertToIPicture(hBitmap) GdipCreateHBITMAPFromBitmap hGdiImage, hBitmap, 0 If GdipCreateBitmapFromFile(StrPtr(strFName), hGdiImage) = 0 Then If GdiplusStartup(hGdiPlus, uGdiInput) = 0 Then Public Function LoadImage(ByVal strFName As String) As IPicture RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As PICTDESC, _ Private Declare Function GdiplusShutdown Lib "GDIPlus" (ByVal token As Long) As Long Private Declare Function GdipDisposeImage Lib "GDIPlus" (ByVal image As Long) As Long HbmReturn As Long, ByVal background As Long) As Long The small/top image will have to have an alpha channel and be transparent in the background for the overlay to work. ![]() You can load the image using Image.FromFile (). Private Declare Function GdipCreateHBITMAPFromBitmap Lib "GDIPlus" (ByVal bitmap As Long, _ Put the big/bottom image on a PictureBox, then add a handler to the OnPaint event and use one of the e.Graphics.DrawImage () overloads. Private Declare Function GdipCreateBitmapFromFile Lib "GDIPlus" (ByVal filename As Long, bitmap As Long) As Long Inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As Long = 0) As Long Private Declare Function GdiplusStartup Lib "GDIPlus" (token As Long, _ ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |