home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / axgrid / modpnttl.bas < prev    next >
Encoding:
BASIC Source File  |  1998-11-12  |  6.9 KB  |  147 lines

  1. Attribute VB_Name = "modPaintEffects"
  2. '-------------------------------------------------------------------------
  3. 'This module provides some needed Type, API, and Constant declarations
  4. '-------------------------------------------------------------------------
  5.  
  6. Option Explicit
  7.  
  8. Public Type POINTAPI
  9.     x As Long
  10.     y As Long
  11. End Type
  12.  
  13. Public Type RECT
  14.     Left As Long
  15.     Top As Long
  16.     Right As Long
  17.     Bottom As Long
  18. End Type
  19.  
  20. Public Type BITMAPINFOHEADER '40 bytes
  21.         biSize As Long
  22.         biWidth As Long
  23.         biHeight As Long
  24.         biPlanes As Integer
  25.         biBitCount As Integer
  26.         biCompression As Long
  27.         biSizeImage As Long
  28.         biXPelsPerMeter As Long
  29.         biYPelsPerMeter As Long
  30.         biClrUsed As Long
  31.         biClrImportant As Long
  32. End Type
  33.  
  34. Public Type RGBQUAD
  35.         rgbBlue As Byte
  36.         rgbGreen As Byte
  37.         rgbRed As Byte
  38.         rgbReserved As Byte
  39. End Type
  40.  
  41. Public Type BITMAPINFO
  42.         bmiHeader As BITMAPINFOHEADER
  43.         bmiColors(1) As RGBQUAD
  44. End Type
  45.  
  46. Global lBackColor As Long, lForeColor As Long
  47.  
  48. Public Declare Function DrawIcon Lib "user32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
  49. Public Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
  50. Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
  51. Public Declare Function SetBkColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
  52. Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long
  53. Public Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
  54. Public Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  55. Public Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
  56. Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  57. Public Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
  58. Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
  59. Public Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long) As Long
  60. Public Declare Function SetTextColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
  61. Public Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
  62. Public Declare Function GetBkColor Lib "gdi32" (ByVal hDC As Long) As Long
  63. Public Declare Function GetTextColor Lib "gdi32" (ByVal hDC As Long) As Long
  64. Public Declare Function SelectPalette Lib "gdi32" (ByVal hDC As Long, ByVal hPalette As Long, ByVal bForceBackground As Long) As Long
  65. Public Declare Function RealizePalette Lib "gdi32" (ByVal hDC As Long) As Long
  66. Public Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hDC As Long) As Long
  67. Public Declare Function CreateHalftonePalette Lib "gdi32" (ByVal hDC As Long) As Long
  68. Public Declare Function OleTranslateColor Lib "oleaut32.dll" (ByVal lOleColor As Long, ByVal lHPalette As Long, lColorRef As Long) As Long
  69. Public Declare Function CreateDIBSection Lib "gdi32" (ByVal hDC As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, ByVal lplpVoid As Long, ByVal handle As Long, ByVal dw As Long) As Long
  70. Public Declare Function SetDIBColorTable Lib "gdi32" (ByVal hDC As Long, ByVal un1 As Long, ByVal un2 As Long, pcRGBQuad As RGBQUAD) As Long
  71. Public Declare Function SetMapMode Lib "gdi32" (ByVal hDC As Long, ByVal nMapMode As Long) As Long
  72. Public Declare Function GetMapMode Lib "gdi32" (ByVal hDC As Long) As Long
  73. Public Declare Function DrawIconEx Lib "user32" (ByVal hDC As Long, ByVal xLeft As Long, ByVal yTop As Long, ByVal hIcon As Long, ByVal cxWidth As Long, ByVal cyHeight As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal diFlags As Long) As Long
  74. Public Declare Function CreatePatternBrush Lib "gdi32" (ByVal hBitmap As Long) As Long
  75.  
  76. Public Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
  77. Public Declare Function DrawEdge Lib "user32" (ByVal hDC As Long, qrc As RECT, ByVal edge As Long, ByVal grfFlags As Long) As Long
  78. Public Declare Function InflateRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
  79.  
  80. ' DrawState used for greyscale conversions
  81. Public Declare Function DrawState Lib "user32" Alias "DrawStateA" (ByVal hDC As Long, ByVal hBrush As Long, ByVal lpDrawStateProc As Long, ByVal lParam As Long, ByVal wParam As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal n3 As Long, ByVal n4 As Long, ByVal un As Long) As Long
  82.  
  83. 'DrawEdge constants
  84. Public Const BDR_INNER = &HC
  85. Public Const BDR_OUTER = &H3
  86. Public Const BDR_RAISED = &H5
  87. Public Const BDR_RAISEDINNER = &H4
  88. Public Const BDR_RAISEDOUTER = &H1
  89. Public Const BDR_SUNKEN = &HA
  90. Public Const BDR_SUNKENINNER = &H8
  91. Public Const BDR_SUNKENOUTER = &H2
  92.  
  93. Public Const EDGE_BUMP = (BDR_RAISEDOUTER Or BDR_SUNKENINNER)
  94. Public Const EDGE_ETCHED = (BDR_SUNKENOUTER Or BDR_RAISEDINNER)
  95. Public Const EDGE_RAISED = (BDR_RAISEDOUTER Or BDR_RAISEDINNER)
  96. Public Const EDGE_SUNKEN = (BDR_SUNKENOUTER Or BDR_SUNKENINNER)
  97.  
  98. Public Const BF_BOTTOM = &H8
  99. Public Const BF_LEFT = &H1
  100. Public Const BF_RIGHT = &H4
  101. Public Const BF_TOP = &H2
  102. Public Const BF_TOPLEFT = (BF_TOP Or BF_LEFT)
  103. Public Const BF_BOTTOMRIGHT = (BF_BOTTOM Or BF_RIGHT)
  104. Public Const BF_RECT = (BF_TOP Or BF_LEFT Or BF_BOTTOM Or BF_RIGHT)
  105.  
  106. Public Const BF_MIDDLE = &H800      'fill in the middle
  107. Public Const BF_SOFT = &H1000        'use for softer buttons
  108. Public Const BF_FLAT = &H4000         'for flat rather than 3d borders
  109. Public Const BF_MONO = &H8000       'for monoschrome borders (actually works better for flat borders)
  110.  
  111. 'DrawIconEx Flags
  112. Public Const DI_MASK = &H1
  113. Public Const DI_IMAGE = &H2
  114. Public Const DI_NORMAL = &H3
  115. Public Const DI_COMPAT = &H4
  116. Public Const DI_DEFAULTSIZE = &H8
  117.  
  118. 'DIB Section constants
  119. Public Const BI_RGB = 0&
  120. Public Const DIB_RGB_COLORS = 0 '  color table in RGBs
  121.  
  122. 'Raster Operation Codes
  123. Public Const DSna = &H220326 '0x00220326
  124.  
  125. 'VB Errors
  126. Public Const giINVALID_PICTURE As Integer = 481
  127.  
  128. ' Constant for GetPixel
  129. Public Const CLR_INVALID = &HFFFF
  130.  
  131. ' DrawState constants
  132. Public Const DSS_DISABLED = &H20
  133. Public Const DSS_MONO = &H80
  134. Public Const DSS_NORMAL = &H0
  135. Public Const DSS_RIGHT = &H8000
  136. Public Const DSS_UNION = &H10
  137. Public Const DST_BITMAP = &H4
  138. Public Const DST_COMPLEX = &H0
  139. Public Const DST_ICON = &H3
  140. Public Const DST_PREFIXTEXT = &H2
  141. Public Const DST_TEXT = &H1
  142.  
  143. 'A few comments:
  144. '-The lparam is the picture property of the source Picture.
  145. '-If the picture is an icon use un=DST_ICON Or DSS_DISABLED, and if it's a
  146. 'bitmap use un=DST_BITMAP Or DSS_DISABLED
  147.