|
-
Jun 15th, 2000, 10:17 AM
#1
Thread Starter
Fanatic Member
Anybody know how to get a picture loaded from a file directly into a DC without having to display it in a picturebox and bitblt it to the dc.
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Jun 15th, 2000, 11:41 AM
#2
PowerPoster
See the demo project on my website
-
Jun 16th, 2000, 04:35 AM
#3
Lively Member
In your module declare these functions and variables:
________________________________
'API FUNCTIONS
Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
'Variables
Public MyPicture_DC as long
_________________________________
Then write a function to load the image:
_________________________________
Sub Create_DC()
MyPicture_DC = CreateCompatibleDC(0)
SelectObject MyPicture_DC, LoadPicture("C:\MyPic.BMP")
End Sub
_________________________________
Now now MyPicture_DC contains the image and you can use Bitblt with it later.
Also in you form unload method use
DeleteDC MyPicture_dc
so that you free up image memory when your done the program.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|