PDA

Click to See Complete Forum and Search --> : DC Behaivior...


Arie
May 30th, 2001, 01:56 PM
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.

Fox
May 30th, 2001, 02:19 PM
Use ReleaseDC instead of DeleteDC..

Arie
May 31st, 2001, 05:42 AM
That Should work? :cool:

Thank you, Fox ;)
Arie.

Fox
May 31st, 2001, 07:00 AM
I don't know the problem but this was indeed wrong ;)

Arie
May 31st, 2001, 07:16 AM
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.

Fox
May 31st, 2001, 09:49 AM
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:


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!

Arie
Jun 1st, 2001, 04:27 AM
But I've already got the problem fixed.
Thanx for the idea.

Arie.