Hey all. I've been beating this thing over and over, and I still don't know what's occuring.

I'm trying to get my function to load up an entire bitmap image within the space of the picturebox (ie: a thumbnail.) So far, I've been able to get the image into the box, but I can't figure a way around the color appearance. When I load a 24-bit bmp, it still displays it like a 8-bit! How do I fix this?

Here's the code I'm using (at the moment):
VB Code:
  1. Public Function DisplayBMP(picBox As PictureBox, fileName As String) As Boolean
  2.     Dim hDC As Long, hBMP As Long
  3.     Dim fileNo As Integer, counter As Integer
  4.     Dim imgSize As POINT
  5.            
  6.     DisplayBMP = False
  7.    
  8.     fileNo = FreeFile
  9.     Open fileName For Binary As fileNo
  10.         Get #fileNo, 19, imgSize
  11.     Close fileNo
  12.        
  13.     counter = 0
  14.     Do
  15.         hDC = CreateCompatibleDC(picBox.hDC)
  16.         counter = counter + 1
  17.     Loop While hDC < 1 Or counter < 15
  18.    
  19.     If hDC < 1 Then
  20.         MsgBox "Failed on Device Context creation"
  21.         Exit Function
  22.     End If
  23.    
  24.     hBMP = LoadImage(0, fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE Or LR_DEFAULTSIZE)
  25.     If hBMP = 0 Then
  26.         DeleteDC hDC
  27.         MsgBox "Failed to load the image"
  28.         Exit Function
  29.     End If
  30.    
  31.     SelectObject hDC, hBMP
  32.     DeleteObject hBMP
  33.            
  34.     StretchBlt picBox.hDC, 0, 0, picBox.Width, picBox.Height, hDC, 0, 0, imgSize.X * 15, imgSize.Y * 15, vbSrcCopy
  35.    
  36.     picBox.Refresh
  37.  
  38.     DeleteDC hDC
  39.  
  40. End Sub
Any help on how to fix my color problem, or on how to better implement this, is greatly appreciated.

Destined