-
DC Behaivior...
Hi!
Here is the code for an example of how should I
Use DCs.
Code:
*****
Open Path & "main.stf" For Input As FreeFile
For Y = 1 to 37
For X = 1 to 50
Input #1, Map(X,Y).Number
Next X
Next Y
Close #1
For Y = 1 to 37
For X = 1 to 50
TempDC = LoadDC(Path & Map(X, Y).Number & ".bmp", Form1.hDC)
BitBlt Form1.hDC, (X * 16) - 16, (Y * 16) - 16, 16, 16, TempDC, 0, 0, vbSrcCopy
DeleteDC TempDC ' Should I delete it here?
Next X
Next Y
******
It gets stock in my computer (64MB).
I don't know what to do...
Try to tell me,
Thank you,
Arie.
-
Use ReleaseDC instead of DeleteDC..
-
That Should work? :cool:
Thank you, Fox ;)
Arie.
-
I don't know the problem but this was indeed wrong ;)
-
Hey, Fox.
It's the same problem as it was before.
You know what,
Explain me, how should I use the OffScreen DC to load
a full-screen 800x600 full of 16x16 pics.
It's about 1850 pics to load.
How should I do best?
Thank you,
Arie.
-
You mean you want to create one big buffer that holds many pictures, each of them 16x16?
If so create the buffer first, then load each DC, blit to the buffer, then unload again.. I'll write you the basic code:
Code:
Dim Buffer As Long
Dim DC As Long
Dim A As Long
Dim B As Long
Buffer = CreateDC( 800, 600 )
For A = 0 To 16
For B = 0 To 16
DC = LoadBitmap( Path & CStr( A ) & ".bmp" ) 'Whatever
BitBlt Buffer, A*16, B*16, 16, 16, DC, 0, 0, vbSrcCopy )
ReleaseDC Me.hWnd, DC
Next
Next
'Copy buffer wherever you need here
'When unloading the app release the buffer DC!
-
Thank yo, Fox...
But I've already got the problem fixed.
Thanx for the idea.
Arie.