Here is the 1D version. cyborg I was unable to get SetDiBits working with what you posted

VB Code:
  1. Private Type RGBQUAD
  2.  Blue  As Byte
  3.  Green As Byte
  4.  Red   As Byte
  5.  Alpha As Byte
  6. End Type
  7.  
  8. Private Type BITMAPINFOHEADER '40 bytes
  9.     biSize As Long
  10.     biWidth As Long
  11.     biHeight As Long
  12.     biPlanes As Integer
  13.     biBitCount As Integer
  14.     biCompression As Long
  15.     biSizeImage As Long
  16.     biXPelsPerMeter As Long
  17.     biYPelsPerMeter As Long
  18.     biClrUsed As Long
  19.     biClrImportant As Long
  20. End Type
  21. Private Type BITMAPINFO
  22.     bmiHeader As BITMAPINFOHEADER
  23.     bmiColors(0 To 255) As RGBQUAD
  24. End Type
  25.  
  26. Private Type SAFEARRAY1D
  27.     cDims As Integer
  28.     fFeatures As Integer
  29.     cbElements As Long
  30.     cLocks As Long
  31.     pvData As Long
  32.     cElements As Long
  33.     lLbound As Long
  34. End Type
  35.  
  36. Private Const BI_RGB& = 0&
  37. Private Const DIB_RGB_COLORS& = 0&
  38.  
  39. Dim BM_256 As BITMAPINFO
  40.  
  41. Dim Bytes8() As Byte
  42. Dim PadBytes8 As Long
  43.  
  44. Dim X As Long
  45. Dim Y As Long
  46.  
  47. Dim Wide As Integer
  48. Dim High As Integer
  49. Dim DrawWidthBytes&
  50. Dim AddDrawWidth&
  51. Dim BufUbound&
  52. Dim TopLeft&
  53. Dim DrawLeft&
  54. Dim DrawRight&
  55.  
  56. Dim Res&
  57.  
  58. Private Declare Function StretchDIBits Lib "gdi32" (ByVal hDC As Long, _
  59.  ByVal X As Long, ByVal Y As Long, _
  60.  ByVal DesW As Long, ByVal DesH As Long, _
  61.  ByVal SrcXOffset As Long, ByVal SrcYOffset As Long, _
  62.  ByVal SrcW As Long, ByVal SrcH As Long, _
  63.   lpBits As Any, lpBitsInfo As BITMAPINFO, _
  64.  ByVal wUsage As Long, ByVal dwRop As Long) As Long
  65.  
  66. Private Sub Form_Activate()
  67.  
  68.  ScaleMode = vbPixels
  69.  
  70.  DoEvents
  71.  
  72.  Wide = 250
  73.  High = 200
  74.  
  75.  With BM_256.bmiHeader
  76.   .biBitCount = 8
  77.   .biWidth = Wide
  78.   .biHeight = High
  79.   .biClrImportant = 256
  80.   .biClrUsed = 256
  81.   .biSize = Len(BM_256.bmiHeader)
  82.  
  83.   PadBytes8 = 4 - Wide Mod 4
  84.   If PadBytes8 = 4 Or .biBitCount = 32 Then PadBytes8 = 0
  85.  
  86.   DrawWidthBytes = Wide * .biBitCount / 8 + PadBytes8
  87.   .biSizeImage = DrawWidthBytes * High
  88.  
  89.   .biCompression = BI_RGB
  90.   .biPlanes = 1
  91.  End With
  92.  
  93.  For X = 0 To 255
  94.   BM_256.bmiColors(X).Blue = X
  95.   BM_256.bmiColors(X).Green = X
  96.   BM_256.bmiColors(X).Red = X
  97.  Next
  98.  
  99.  BufUbound = DrawWidthBytes * High - 1
  100.  
  101.  ReDim Bytes8(BufUbound)
  102.  
  103.  AddDrawWidth = Wide - 1
  104.  TopLeft = DrawWidthBytes * (High - 1)
  105.  
  106.  For Y = 0 To TopLeft Step DrawWidthBytes
  107.   X = 0
  108.   DrawRight = Y + AddDrawWidth
  109.   For Res = Y To DrawRight
  110.    Bytes8(Res) = 255 * X / Wide
  111.    X = X + 1
  112.   Next
  113.  Next
  114.  
  115.  If StretchDIBits(Form1.hDC, 0, 0, Wide, High, 0, 0, Wide, High, _
  116.                   Bytes8(0), _
  117.                   BM_256, DIB_RGB_COLORS, vbSrcCopy) = 0 Then
  118.                  
  119.      Caption = "Blit Error"
  120.  
  121.  End If
  122.  
  123. End Sub