Results 1 to 6 of 6

Thread: I'm so confused!!! [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    229

    I'm so confused!!! [RESOLVED]

    Code:
    Option Explicit
    
    Public Function LoadGraphics(FileName As String, PosX As Long, PosY As Long, Width As Long, Height As Long) As Long
        On Error GoTo ErrHandler
        
        Dim DC As Long
        Dim DestDC As Long
        Dim Image As Long
        Dim NewTile As Integer
        
        NewTile = frmMain.MapTiles.Count
        
        Load frmMain.MapTiles(NewTile)
        frmMain.MapTiles(NewTile).Visible = True
        frmMain.MapTiles(NewTile).Move Rnd * 1000, Rnd * 1000
        
        FileName = App.Path & "\Maps\" & FileName
        
        DestDC = GetDC(frmMain.MapTiles(NewTile).hwnd)
        
        DC = CreateCompatibleDC(DestDC)
        
        Image = LoadImage(0, FileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)
        
        SelectObject DC, Image
        
        BitBlt DestDC, 0, 0, Width, Height, DC, PosX, PosY, SRCCOPY
        
        DeleteDC DC
        DeleteDC DestDC
        DeleteObject Image
        
        Exit Function
        
    ErrHandler:
        MsgBox Err.Number & Err.Description
    End Function
    That's my code to retrieve a part of an image and put it in a picture box. But it's not working !! WHHHHHYYY???? WHHHHHHHHHHYYYYYYYY GOOOOOOOOOODDD!!!! Can someone please check it out for me or give me SIMPLE WORKING CODE. thank you!
    Last edited by INF3RN0666; May 18th, 2003 at 03:13 PM.

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