Results 1 to 7 of 7

Thread: DC Behaivior...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Unhappy 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.

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Use ReleaseDC instead of DeleteDC..

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    That Should work?

    Thank you, Fox
    Arie.

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    I don't know the problem but this was indeed wrong

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    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.

  6. #6
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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!
    Last edited by Fox; May 31st, 2001 at 12:25 PM.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Thank yo, Fox...

    But I've already got the problem fixed.
    Thanx for the idea.

    Arie.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width