home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / MorphRange205133332007.psc / MorphRangeRoamer.ctl < prev   
Text File  |  2007-02-18  |  53KB  |  803 lines

  1. VERSION 5.00
  2. Begin VB.UserControl MorphRangeRoamer 
  3.    AutoRedraw      =   -1  'True
  4.    ClientHeight    =   810
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   450
  8.    ScaleHeight     =   54
  9.    ScaleMode       =   3  'Pixel
  10.    ScaleWidth      =   30
  11.    ToolboxBitmap   =   "MorphRangeRoamer.ctx":0000
  12. End
  13. Attribute VB_Name = "MorphRangeRoamer"
  14. Attribute VB_GlobalNameSpace = False
  15. Attribute VB_Creatable = True
  16. Attribute VB_PredeclaredId = False
  17. Attribute VB_Exposed = False
  18. '*************************************************************************
  19. '* MorphRangeRoamer 1.02 - --->VB6<--- UpDown/Slider hybrid usercontrol. *
  20. '* Author: Matthew R. Usner, Dec. 2006 for www.planet-source-code.com.   *
  21. '* Last update 18 Feb 2007 - Added .UD_SwapDirections property.          *
  22. '* The most up-to-date version of this control can always be found at:   *
  23. '* www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=67526&lngWId=1       *
  24. '* Copyright ⌐2006 - 2007, Matthew R. Usner.  All rights reserved.       *
  25. '*************************************************************************
  26. '* MorphRangeRoamer is my attempt to overcome the inadequacies of the    *
  27. '* humble UpDown and Slider controls.  To a reasonable extent, I believe *
  28. '* I succeeded.  I like the concept of the UpDown control but rarely use *
  29. '* it.  Why?  Because it's realistically only useful for selecting among *
  30. '* a small range of values, otherwise you're stuck clicking down on one  *
  31. '* of the direction buttons forever waiting for the correct value.  Auto-*
  32. '* matic value acceleration via the .Increment property helps, but not a *
  33. '* great deal.  Usually I end up overshooting my target by a gazillion   *
  34. '* and have to go back. The Slider, on the other hand, is good for huge  *
  35. '* ranges, but only if it takes up a lot of screen space.  Tweaking it   *
  36. '* to narrow it down to a specific value is a pain. MorphRangeRoamer is  *
  37. '* an UpDown/Slider hybrid that tries to improve the efficiency of both  *
  38. '* controls by having them seamlessly work together.  Both small and     *
  39. '* large ranges of values are handled easily. At first, MorphRangeRoamer *
  40. '* acts much like a typical VB UpDown.  Click the up or down buttons to  *
  41. '* increase or decrease the .Value property. Click and hold on one of    *
  42. '* the direction buttons and the .Value will increment or decrement at   *
  43. '* definable rates of speed.  You can set properties that control the    *
  44. '* size of the value increment when the Ctrl, Shift, or both keys are    *
  45. '* held down while clicking the UpDown buttons.  For example, the default*
  46. '* increment could be 1, the increment while holding Ctrl could be 10,   *
  47. '* while holding Shift 100, and Ctrl-Shift 1000.  This helps you navigate*
  48. '* through large ranges much more efficiently than a regular UpDown. For *
  49. '* larger ranges, after a definable time interval clicking and holding   *
  50. '* down an UpDown button, a Slider-esque "RangeWindow" appears.  By keep-*
  51. '* ing the mouse button held down, and moving the mouse right or left in *
  52. '* the progress bar, you can instantly move anywhere in the value range. *
  53. '* The progress bar and LED display in the RangeWindow let you keep      *
  54. '* track of where you are in the value range you have defined in the     *
  55. '* appropriate properties.  When you're close to (or at) the value you   *
  56. '* want, release the mouse button.  The RangeWindow disappears and you   *
  57. '* can click the up or down button a few times (using Shift and/or Ctrl  *
  58. '* if necessary) until precisely the right value is chosen.  In this     *
  59. '* fashion, you can use MorphRangeRoamer to very quickly navigate        *
  60. '* through much larger value ranges than the intrinsic UpDown is capable *
  61. '* of efficiently doing, with more precision than is convenient with the *
  62. '* Slider.  There are some limitations; I am not trying to imply this    *
  63. '* control is suitable for ranges in the billions, it's not.  Pixels     *
  64. '* (RangeWindow operation) and ease of keyboard use (UpDown) prevent     *
  65. '* that.  And as this is an early version, there is no BuddyControl      *
  66. '* capability.  I may or may not add it; for now you'll have to emulate  *
  67. '* BuddyControl functionality in your project's form code (which is what *
  68. '* many coders do anyway).  But when you try this you'll see how much it *
  69. '* outperforms the VB UpDown and Slider controls in many respects!       *
  70. '*************************************************************************
  71. '*    CONSTRUCTIVE FEEDBACK ALWAYS WELCOME, VOTES ALWAYS APPRECIATED!    *
  72. '*************************************************************************
  73. '* Legal:  Redistribution of this code, whole or in part, as source code *
  74. '* or in binary form, alone or as part of a larger distribution or prod- *
  75. '* uct, is forbidden for any commercial or for-profit use without the    *
  76. '* author's explicit written permission.                                 *
  77. '*                                                                       *
  78. '* Non-commercial redistribution of this code, as source code or in      *
  79. '* binary form, with or without modification, is permitted provided that *
  80. '* the following conditions are met:                                     *
  81. '*                                                                       *
  82. '* Redistributions of source code must include this list of conditions,  *
  83. '* and the following acknowledgment:                                     *
  84. '*                                                                       *
  85. '* This VB6 usercontrol was developed by Matthew R. Usner.               *
  86. '* Source code, written in Visual Basic 6.0, is freely available for     *
  87. '* non-commercial, non-profit use.                                       *
  88. '*                                                                       *
  89. '* Redistributions in binary form, as part of a larger project, must     *
  90. '* include the above acknowledgment in the end-user documentation.       *
  91. '* Alternatively, the above acknowledgment may appear in the software    *
  92. '* itself, if and where such third-party acknowledgments normally appear.*
  93. '*************************************************************************
  94. '* Credits and Thanks:                                                   *
  95. '* Carles P.V., for the gradient generation code and CreateWindowEx tip. *
  96. '* LaVolpe, for the border segment region generation code.               *
  97. '*************************************************************************
  98.  
  99. Option Explicit
  100.  
  101. Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal nXDest As Long, ByVal nYDest 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
  102. Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  103. Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
  104. Private Declare Function CreatePolygonRgn Lib "gdi32.dll" (ByRef lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
  105. Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  106. Private Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Long) As Long
  107. Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
  108. Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
  109. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  110. Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
  111. Private Declare Function FillRgn Lib "gdi32.dll" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long) As Long
  112. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  113. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
  114. Private Declare Function GetRgnBox Lib "gdi32" (ByVal hRgn As Long, lpRect As RECT) As Long
  115. Private Declare Function GetTickCount Lib "kernel32" () As Long
  116. Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
  117. Private Declare Function OffsetRgn Lib "gdi32.dll" (ByVal hRgn As Long, ByVal x As Long, ByVal y As Long) As Long
  118. Private Declare Function OleTranslateColor Lib "olepro32.dll" (ByVal OLE_COLOR As Long, ByVal hPalette As Long, pccolorref As Long) As Long
  119. Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
  120. Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
  121. Private Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
  122. Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
  123. Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
  124. Private Declare Function StretchDIBits Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal wSrcWidth As Long, ByVal wSrcHeight As Long, lpBits As Any, lpBitsInfo As Any, ByVal wUsage As Long, ByVal dwRop As Long) As Long
  125. Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
  126. Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
  127.  
  128. ' enum tied to .UD_Orientation property.
  129. Public Enum MRR_Orientation
  130.    Vertical
  131.    Horizontal
  132. End Enum
  133.  
  134. ' enum tied to .Theme property.
  135. Public Enum MRR_ThemeOptions
  136.    [None] = 0
  137.    [Cyan Eyed] = 1
  138.    [Gunmetal Grey] = 2
  139.    [Blue Moon] = 3
  140.    [Red Rum] = 4
  141.    [Green With Envy] = 5
  142.    [Purple People Eater] = 6
  143.    [Golden Goose] = 7
  144.    [Penny Wise] = 8
  145. End Enum
  146.  
  147. ' ********** updown graphics declares. *********
  148.  
  149. ' declares for gradient painting and bitmap tiling.
  150. Private Type BITMAPINFOHEADER
  151.    biSize                                     As Long
  152.    biWidth                                    As Long
  153.    biHeight                                   As Long
  154.    biPlanes                                   As Integer
  155.    biBitCount                                 As Integer
  156.    biCompression                              As Long
  157.    biSizeImage                                As Long
  158.    biXPelsPerMeter                            As Long
  159.    biYPelsPerMeter                            As Long
  160.    biClrUsed                                  As Long
  161.    biClrImportant                             As Long
  162. End Type
  163.  
  164. Private Type POINTAPI
  165.    x                                          As Long
  166.    y                                          As Long
  167. End Type
  168. Private CursorPos As POINTAPI                                      ' RangeWindow cursor XY for progressbar.
  169.  
  170. Private Const DIB_RGB_COLORS                  As Long = 0          ' used in gradient generation and transfer.
  171.  
  172. '  gradient generation constants.
  173. Private Const PI                              As Single = 3.14159265358979
  174. Private Const TO_DEG                          As Single = 180 / PI
  175. Private Const TO_RAD                          As Single = PI / 180
  176. Private Const INT_ROT                         As Long = 1000
  177.  
  178. '  used to define various graphics areas and updown component locations.
  179. Private Type RECT
  180.    Left                                       As Long
  181.    Top                                        As Long
  182.    Right                                      As Long
  183.    Bottom                                     As Long
  184. End Type
  185.  
  186. ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< UpDown Button declares >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  187. ' 4 virtual bitmaps created - 2 for left/top button, 2 for right/bottom button.  For each
  188. ' button one bitmap holds graphics for button in up state, the other for button in down state.
  189. ' ******************* top/left button *******************************
  190.  
  191. Private ButtonWidth                           As Long              ' width, in pixels, of UpDown button.
  192. Private ButtonHeight                          As Long              ' height, in pixels, of UpDown button.
  193.  
  194. ' coordinates of UpDown buttons.
  195. Private Type ButtonCoordinates
  196.    X1                                         As Long
  197.    Y1                                         As Long
  198.    X2                                         As Long
  199.    Y2                                         As Long
  200. End Type
  201. Private ButtonCoords(1 To 2)                  As ButtonCoordinates
  202.  
  203. ' mouse location constants.
  204. Private Const LEFT_OR_TOP_BUTTON              As Long = 1
  205. Private Const RIGHT_OR_BOTTOM_BUTTON          As Long = 2
  206. Private Const MOUSE_NOT_IN_BUTTON             As Long = 0
  207. Private Const MOUSE_IN_LEFT_OR_TOP_BUTTON     As Long = 1
  208. Private Const MOUSE_IN_RIGHT_OR_BOTTOM_BUTTON As Long = 2
  209. Private MouseLocation                         As Long              ' assigned one of the above constants.
  210.  
  211. ' declares for UpDown 'up' button virtual bitmap.
  212. Private UD_VirtualDC_LT_ButtonUp              As Long              ' handle of the created DC.
  213. Private UD_mMemoryBitmap_LT_ButtonUp          As Long              ' handle of the created bitmap.
  214. Private UD_mOriginalBitmap_LT_ButtonUp        As Long              ' used in destroying virtual DC.
  215.  
  216. ' declares for UpDown 'down' button virtual bitmap.
  217. Private UD_VirtualDC_LT_ButtonDown            As Long              ' handle of the created DC.
  218. Private UD_mMemoryBitmap_LT_ButtonDown        As Long              ' handle of the created bitmap.
  219. Private UD_mOriginalBitmap_LT_ButtonDown      As Long              ' used in destroying virtual DC.
  220.  
  221. ' ******************* bottom/right button *******************************
  222. ' declares for UpDown 'up' button virtual bitmap.
  223. Private UD_VirtualDC_RB_ButtonUp              As Long              ' handle of the created DC.
  224. Private UD_mMemoryBitmap_RB_ButtonUp          As Long              ' handle of the created bitmap.
  225. Private UD_mOriginalBitmap_RB_ButtonUp        As Long              ' used in destroying virtual DC.
  226.  
  227. ' declares for UpDown 'down' button virtual bitmap.
  228. Private UD_VirtualDC_RB_ButtonDown            As Long              ' handle of the created DC.
  229. Private UD_mMemoryBitmap_RB_ButtonDown        As Long              ' handle of the created bitmap.
  230. Private UD_mOriginalBitmap_RB_ButtonDown      As Long              ' used in destroying virtual DC.
  231.  
  232. '  gradient information for updown button faces.
  233. Private UD_ButtonUp_uBIH                      As BITMAPINFOHEADER
  234. Private UD_ButtonUp_lBits()                   As Long
  235. Private UD_ButtonDown_LT_uBIH                 As BITMAPINFOHEADER
  236. Private UD_ButtonDown_LT_lBits()              As Long
  237. Private UD_ButtonDown_RB_uBIH                 As BITMAPINFOHEADER
  238. Private UD_ButtonDown_RB_lBits()              As Long
  239. '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  240.  
  241. ' constants defining the four border segments.
  242. Private Const TOP_SEGMENT                     As Long = 0
  243. Private Const RIGHT_SEGMENT                   As Long = 1
  244. Private Const BOTTOM_SEGMENT                  As Long = 2
  245. Private Const LEFT_SEGMENT                    As Long = 3
  246.  
  247. ' ******************** UpDown border declares ************************
  248. '  gradient information for UpDown horizontal and vertical border segments.
  249. Private UD_SegV1uBIH                          As BITMAPINFOHEADER
  250. Private UD_SegV1lBits()                       As Long
  251. Private UD_SegV2uBIH                          As BITMAPINFOHEADER
  252. Private UD_SegV2lBits()                       As Long
  253. Private UD_SegH1uBIH                          As BITMAPINFOHEADER
  254. Private UD_SegH1lBits()                       As Long
  255. Private UD_SegH2uBIH                          As BITMAPINFOHEADER
  256. Private UD_SegH2lBits()                       As Long
  257.  
  258. ' holds region pointers for UpDown border segments.
  259. Private UD_BorderSegment(0 To 3)              As Long
  260.  
  261. ' declares for horizontal border segment virtual bitmap.
  262. Private UD_VirtualDC_SegH                     As Long              ' handle of the created DC.
  263. Private UD_mMemoryBitmap_SegH                 As Long              ' handle of the created bitmap.
  264. Private UD_mOriginalBitmap_SegH               As Long              ' used in destroying virtual DC.
  265.  
  266. ' declares for vertical border segment virtual bitmap.
  267. Private UD_VirtualDC_SegV                     As Long              ' handle of the created DC.
  268. Private UD_mMemoryBitmap_SegV                 As Long              ' handle of the created bitmap.
  269. Private UD_mOriginalBitmap_SegV               As Long              ' used in destroying virtual DC.
  270.  
  271. Private CtrlKeyDown                           As Boolean           ' global "ctrl key being pressed" flag.
  272. Private ShiftKeyDown                          As Boolean           ' global "shift key is being pressed" flag.
  273. Private ShiftAndCtrlDown                      As Boolean           ' both Shift and Ctrl keys are down.
  274.  
  275. ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< RangeWindow declares >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  276. Private RangeWindowWidth                      As Long              ' width, in pixels, of the RangeWindow.
  277. Private RangeWindowHeight                     As Long              ' height, in pixels, of the RangeWindow.
  278. Private RW_BG_Width                           As Long              ' RangeWindow background bitmap width.
  279. Private RW_BG_Height                          As Long              ' RangeWindow background bitmap height.
  280. Private RW_X1                                 As Long              ' left coord of RangeWindow progressbar.
  281. Private RW_X2                                 As Long              ' right coord of RangeWindow progressbar.
  282. Private RW_Y1                                 As Long              ' top coordinate of RangeWindow progress dragbar.
  283. Private RW_Y2                                 As Long              ' bottom coordinate of RangeWindow progress dragbar.
  284.  
  285. ' declares that are used to make sure RangeWindow is always fully visible on screen (Y coordinate).
  286. Private ScreenWorkArea                        As RECT              ' screen area without taskbar.
  287. Private Const SPI_GETWORKAREA                 As Long = 48&        ' used in SystemParametersInfo API call.
  288. Private TaskBarHeight                         As Long              ' for adjustment of RangeWindow Y coord.
  289.  
  290. ' RangeWindow LED display declares.
  291. Private LEDSegment(0 To 1)                    As Long              ' region pointers for LED digit segments.
  292. Private Const VERTICAL_LED_SEGMENT            As Long = 0          ' vertical LED segment region index.
  293. Private Const HORIZONTAL_LED_SEGMENT          As Long = 1          ' vertical LED segment region index.
  294. Private Const SEGMENT_LIT                     As String = "1"      ' segment lit constant.
  295. Private Const SEGMENT_UNLIT                   As String = "0"      ' segment unlit constant.
  296. Private Const SegmentWidth                    As Long = 2          ' LED digit segment width, in pixels.
  297. Private Const SegmentHeight                   As Long = 7          ' LED digit segment height, in pixels.
  298. Private LEDLitColorBrush                      As Long              ' color brush for lit LED segments.
  299. Private LEDBurnInColorBrush                   As Long              ' color brush for 'burned in' LED segments.
  300. Private DisplayPattern()                      As String            ' LED digit segment display patterns.
  301. Private Const InterSegmentGap                 As Long = 1          ' number of pixels between LED digit segments.
  302. Private DigitHeight                           As Long              ' pixel height of LED digit.
  303. Private DigitWidth                            As Long              ' pixel width of LED digit.
  304. Private DigitXPos(0 To 9)                     As Long              ' X coordinate of each value LED digit.
  305. Private Const InterDigitGap                   As Long = 6          ' number of pixels between each LED digit.
  306. Private PreviousValue                         As String            ' helps in displaying only changed LED digits.
  307. Private Const MAX_DIGITS                      As Long = 10         ' # of possible LED digits (including minus sign).
  308.  
  309. ' declares for RangeWindow virtual bitmap.
  310. Private RW_VirtualDC                          As Long              ' handle of the created DC.
  311. Private RW_mMemoryBitmap                      As Long              ' handle of the created bitmap.
  312. Private RW_mOriginalBitmap                    As Long              ' used in destroying virtual DC.
  313.  
  314. ' declares for RangeWindow LED display background virtual bitmap.
  315. Private RW_BG_VirtualDC                       As Long              ' handle of the created DC.
  316. Private RW_BG_mMemoryBitmap                   As Long              ' handle of the created bitmap.
  317. Private RW_BG_mOriginalBitmap                 As Long              ' used in destroying virtual DC.
  318.  
  319. ' gradient information for RangeWindow progress bar meter.
  320. Private RW_Meter_uBIH                         As BITMAPINFOHEADER
  321. Private RW_Meter_lBits()                      As Long
  322.  
  323. ' gradient information for RangeWindow display background.
  324. Private RW_BG_uBIH                            As BITMAPINFOHEADER
  325. Private RW_BG_lBits()                         As Long
  326.  
  327. ' RangeWindow CreateWindowEx constants.
  328. Private Const SS_CUSTOMDRAW                   As Long = &HD
  329. Private Const SW_SHOWNORMAL                   As Long = 1
  330. Private Const WS_POPUP                        As Long = &H80000000
  331. Private Const WS_EX_TOOLWINDOW                As Long = &H80&
  332.  
  333. ' used in SetWindowPos API to ignore resizing and repositioning when setting RangeWindow ZOrder to topmost.
  334. Private Const HWND_TOP                        As Long = 0
  335. Private Const SWP_NOMOVE                      As Long = &H2
  336. Private Const SWP_NOSIZE                      As Long = &H1
  337.  
  338. Private RangeWindowPopped                     As Boolean           ' "RangeWindow activated" flag.
  339. Private RWhWnd                                As Long              ' RangeWindow virtual window handle.
  340. Private RWhDC                                 As Long              ' RangeWindow virtual window DC.
  341.  
  342. ' ************************* RangeWindow border declares *************************
  343. ' gradient information for RangeWindow horizontal and vertical border segments.
  344. Private RW_SegV1uBIH                          As BITMAPINFOHEADER
  345. Private RW_SegV1lBits()                       As Long
  346. Private RW_SegV2uBIH                          As BITMAPINFOHEADER
  347. Private RW_SegV2lBits()                       As Long
  348. Private RW_SegH1uBIH                          As BITMAPINFOHEADER
  349. Private RW_SegH1lBits()                       As Long
  350. Private RW_SegH2uBIH                          As BITMAPINFOHEADER
  351. Private RW_SegH2lBits()                       As Long
  352.  
  353. ' holds region pointers for RangeWindow border segments.
  354. Private RW_BorderSegment(0 To 3)              As Long
  355.  
  356. ' declares for horizontal border segment virtual bitmap.
  357. Private RW_VirtualDC_SegH                     As Long              ' handle of the created DC.
  358. Private RW_mMemoryBitmap_SegH                 As Long              ' handle of the created bitmap.
  359. Private RW_mOriginalBitmap_SegH               As Long              ' used in destroying virtual DC.
  360.  
  361. ' declares for vertical border segment virtual bitmap.
  362. Private RW_VirtualDC_SegV                     As Long              ' handle of the created DC.
  363. Private RW_mMemoryBitmap_SegV                 As Long              ' handle of the created bitmap.
  364. Private RW_mOriginalBitmap_SegV               As Long              ' used in destroying virtual DC.
  365. '********************************************************************************
  366.  
  367. ' default property values.  They correspond to the "Gunmetal Grey" theme.
  368. Private Const m_def_Enabled = True
  369. Private Const m_def_RW_BackAngle = 90
  370. Private Const m_def_RW_BackColor1 = 0
  371. Private Const m_def_RW_BackColor2 = &H404040
  372. Private Const m_def_RW_BackMiddleOut = True
  373. Private Const m_def_RW_BorderColor1 = 0
  374. Private Const m_def_RW_BorderColor2 = &H808080
  375. Private Const m_def_RW_BorderMiddleOut = True
  376. Private Const m_def_RW_BorderWidth = 8
  377. Private Const m_def_RW_GenerateEvent = True
  378. Private Const m_def_RW_LED_BurnInColor = &H404040
  379. Private Const m_def_RW_LED_DigitColor = &HE0E0E0
  380. Private Const m_def_RW_LED_ShowBurnIn = True
  381. Private Const m_def_RW_PBarColor1 = &H0
  382. Private Const m_def_RW_PBarColor2 = &HE0E0E0
  383. Private Const m_def_RW_PopInterval = 3000
  384. Private Const m_def_RW_ShowLED = True
  385. Private Const m_def_Theme = 2
  386. Private Const m_def_UD_ArrowColor = &HFFFFFF
  387. Private Const m_def_UD_AutoIncrement = False
  388. Private Const m_def_UD_BorderColor1 = &H0
  389. Private Const m_def_UD_BorderColor2 = &HC0C0C0
  390. Private Const m_def_UD_BorderMiddleOut = True
  391. Private Const m_def_UD_BorderWidth = 8
  392. Private Const m_def_UD_ButtonColor1 = &H0
  393. Private Const m_def_UD_ButtonColor2 = &HC0C0C0
  394. Private Const m_def_UD_ButtonDownAngle = 90
  395. Private Const m_def_UD_ButtonDownMidOut = False
  396. Private Const m_def_UD_ButtonUpAngle = 90
  397. Private Const m_def_UD_ButtonUpMidOut = True
  398. Private Const m_def_UD_DisArrowColor = &H909090
  399. Private Const m_def_UD_DisBorderColor1 = &H808080
  400. Private Const m_def_UD_DisBorderColor2 = &HE0E0E0
  401. Private Const m_def_UD_DisButtonColor1 = &H808080
  402. Private Const m_def_UD_DisButtonColor2 = &HE0E0E0
  403. Private Const m_def_UD_FocusBorderColor1 = &H0
  404. Private Const m_def_UD_FocusBorderColor2 = &H808080
  405. Private Const m_def_UD_IncrementInterval = 250
  406. Private Const m_def_UD_Orientation = [Vertical]
  407. Private Const m_def_UD_ScrollDelay = 1000
  408. Private Const m_def_UD_SwapDirections = False
  409. Private Const m_def_Value = 0
  410. Private Const m_def_ValueIncrCtrl = 10
  411. Private Const m_def_ValueIncrement = 1
  412. Private Const m_def_ValueIncrShift = 100
  413. Private Const m_def_ValueIncrShiftCtrl = 1000
  414. Private Const m_def_ValueMax = 100
  415. Private Const m_def_ValueMin = 1
  416. Private Const m_def_Wrap = False
  417.  
  418. ' property variables.
  419. Private m_Enabled                             As Boolean           ' master control enabled flag.
  420. Private m_RW_BackAngle                        As Single            ' RangeWindow background gradient angle.
  421. Private m_RW_BackColor1                       As OLE_COLOR         ' RangeWindow background gradient color 1.
  422. Private m_RW_BackColor2                       As OLE_COLOR         ' RangeWindow background gradient color 2.
  423. Private m_RW_BorderColor1                     As OLE_COLOR         ' RangeWindow border gradient color 1.
  424. Private m_RW_BorderColor2                     As OLE_COLOR         ' RangeWindow border gradient color 2.
  425. Private m_RW_BackMiddleOut                    As Boolean           ' RangeWindow background middle-out status.
  426. Private m_RW_BorderMiddleOut                  As Boolean           ' RangeWindow border middle-out status.
  427. Private m_RW_BorderWidth                      As Long              ' width, in pixels, of RangeWindow border.
  428. Private m_RW_GenerateEvent                    As Boolean           ' Change event thrown in MouseMove? (RangeWindow only).
  429. Private m_RW_LED_BurnInColor                  As OLE_COLOR         ' simulated LED digit burn-in color.
  430. Private m_RW_LED_DigitColor                   As OLE_COLOR         ' LED digit segment color.
  431. Private m_RW_LED_ShowBurnIn                   As Boolean           ' show simulated LED burn-in digits flag.
  432. Private m_RW_PBarColor1                       As OLE_COLOR         ' gradient color 1 of RangeWindow progressbar.
  433. Private m_RW_PBarColor2                       As OLE_COLOR         ' gradient color 2 of RangeWindow progressbar.
  434. Private m_RW_PopInterval                      As Long              ' time (ms) before slider appears.
  435. Private m_RW_ShowLED                          As Boolean           ' if True, RangeWindow LED display is shown.
  436. Private m_Theme                               As MRR_ThemeOptions  ' color scheme for control.
  437. Private m_UD_ArrowColor                       As OLE_COLOR         ' color of button arrows when buttons are up.
  438. Private m_UD_AutoIncrement                    As Boolean           ' sets auto-calculation of various increments.
  439. Private m_UD_BorderColor1                     As OLE_COLOR         ' first UpDown border gradient color.
  440. Private m_UD_BorderColor2                     As OLE_COLOR         ' second UpDown border gradient color.
  441. Private m_UD_BorderMiddleOut                  As Boolean           ' UpDown gradient border middle-out status.
  442. Private m_UD_BorderWidth                      As Long              ' UpDown gradient border width, in pixels.
  443. Private m_UD_ButtonColor1                     As OLE_COLOR         ' first gradient color of UD buttons (up position).
  444. Private m_UD_ButtonColor2                     As OLE_COLOR         ' second gradient color of UD buttons (up position).
  445. Private m_UD_ButtonDownAngle                  As Single            ' button down gradient angle.
  446. Private m_UD_ButtonDownMidOut                 As Boolean           ' button down middle-out gradient status.
  447. Private m_UD_ButtonUpAngle                    As Single            ' button up gradient angle.
  448. Private m_UD_ButtonUpMidOut                   As Boolean           ' button up middle-out gradient status.
  449. Private m_UD_DisArrowColor                    As OLE_COLOR         ' arrow color when control is disabled.
  450. Private m_UD_DisBorderColor1                  As OLE_COLOR         ' border color 1 when control is disabled.
  451. Private m_UD_DisBorderColor2                  As OLE_COLOR         ' border color 2 when control is disabled.
  452. Private m_UD_DisButtonColor1                  As OLE_COLOR         ' button color 1 when control is disabled.
  453. Private m_UD_DisButtonColor2                  As OLE_COLOR         ' button color 2 when control is disabled.
  454. Private m_UD_FocusBorderColor1                As OLE_COLOR         ' UpDown border color 1 when control has focus.
  455. Private m_UD_FocusBorderColor2                As OLE_COLOR         ' UpDown border color 2 when control has focus.
  456. Private m_UD_IncrementInterval                As Long              ' delay, in ms, between .Value auto-increments.
  457. Private m_UD_Orientation                      As MRR_Orientation   ' buttons in vertical or horizontal format.
  458. Private m_UD_ScrollDelay                      As Long              ' delay (ms) before value scrolling begins.
  459. Private m_UD_SwapDirections                   As Boolean           ' swaps increment/decrement if desired.
  460. Private m_Value                               As Long              ' current UpDown value.
  461. Private m_ValueIncrCtrl                       As Long              ' increment when Ctrl key is pressed.
  462. Private m_ValueIncrement                      As Long              ' default increment (should be 1, usually).
  463. Private m_ValueIncrShift                      As Long              ' increment when Shift key is pressed.
  464. Private m_ValueIncrShiftCtrl                  As Long              ' increment when Shift and Ctrl keys are pressed.
  465. Private m_ValueMin                            As Long              ' minimum value in UpDown range.
  466. Private m_ValueMax                            As Long              ' maximum value in UpDown range.
  467. Private m_Wrap                                As Boolean           ' value wraps back to min or max value flag.
  468.  
  469. ' variables that display the enabled/disabled UpDown colors.
  470. Private Active_UD_ArrowColor                  As OLE_COLOR         ' current UpDown button arrow color.
  471. Private Active_UD_BorderColor1                As OLE_COLOR         ' current UpDown gradient border color 1.
  472. Private Active_UD_BorderColor2                As OLE_COLOR         ' current UpDown gradient border color 2.
  473. Private Active_UD_ButtonColor1                As OLE_COLOR         ' current UpDown gradient button color 1.
  474. Private Active_UD_ButtonColor2                As OLE_COLOR         ' current UpDown gradient button color 2.
  475. Private Active_UD_ButtonUpAngle               As Single            ' UpAngle used for both enabled/disabled.
  476. Private Active_UD_ButtonUpMidOut              As Boolean           ' UpMidOut used for both enabled/disabled.
  477.  
  478. 'Event Declarations:
  479. Event MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  480. Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
  481. Event MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  482. Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
  483. Event MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  484. Event Change()
  485.  
  486. ' mouse control variables.
  487. Private MouseX                                As Single            ' global mouse X position variable.
  488. Private MouseY                                As Single            ' global mouse Y position variable.
  489. Private Const MOUSEEVENTF_LEFTDOWN            As Long = &H2        ' for generating a mousedown to replace double click.
  490. Private MouseIsDown                           As Boolean           ' left mouse button down flag.
  491. Private OriginalMouseDownButton               As Long              ' which UpDown button mouse was clicked down in.
  492. Private MoveRelease                           As Boolean           ' flag to unclick button when mouse moved out.
  493. Private RightMouseButtonClicked               As Boolean           ' flag to help ignore right clicking.
  494.  
  495. Private Sub InitializeControlGraphics()
  496.  
  497. '*************************************************************************
  498. '* master procedure for initializing all MorphRangeRoamer graphics.      *
  499. '*************************************************************************
  500.  
  501.    InitializeUpDownGraphics
  502.    InitializeRangeWindowGraphics
  503.  
  504. End Sub
  505.  
  506. Private Sub InitializeUpDownGraphics()
  507.  
  508. '*************************************************************************
  509. '* master procedure for initializing all UpDown graphics.                *
  510. '*************************************************************************
  511.  
  512. '  initialize appropriate display colors.
  513.    If m_Enabled Then
  514.       GetEnabledDisplayProperties
  515.    Else
  516.       GetDisabledDisplayProperties
  517.    End If
  518.  
  519.    InitializeUpDownButtonGraphics
  520.    InitializeUpDownBorderGraphics
  521.  
  522. End Sub
  523.  
  524. Private Sub RedrawControl()
  525.  
  526. '*************************************************************************
  527. '* displays the UpDown portion of the control.                           *
  528. '*************************************************************************
  529.  
  530.    DisplayButton LEFT_OR_TOP_BUTTON
  531.    DisplayButton RIGHT_OR_BOTTOM_BUTTON
  532.    DisplayUpDownBorder
  533.  
  534. End Sub
  535.  
  536. Private Sub InitializeUpDownButtonGraphics()
  537.  
  538. '*************************************************************************
  539. '* initializes UpDown button graphics.                                   *
  540. '*************************************************************************
  541.  
  542.    CalculateUpDownButtonDimensions
  543.    CalculateUpDownButtonCoordinates
  544.    CreateUpDownButtonVirtualBitmaps
  545.    GenerateUpDownButtonGradients
  546.    TransferButtonGradientsToVirtualBitmaps
  547.    TransferArrowsToVirtualBitmaps
  548.  
  549. End Sub
  550.  
  551. Private Sub DisplayUpDownBorder()
  552.  
  553. '*************************************************************************
  554. '* paints the UpDown gradient border.                                    *
  555. '*************************************************************************
  556.  
  557. '  if the borderwidth is greater than 1 pixel, use the gradient border.
  558.    If m_UD_BorderWidth > 1 Then
  559.  
  560.       DisplayBorderSegment UD_VirtualDC_SegV, hdc, ScaleWidth, ScaleHeight, m_UD_BorderWidth, _
  561.                            UD_BorderSegment(), LEFT_SEGMENT, 0, 0, UD_SegV1uBIH, UD_SegV1lBits(), _
  562.                            m_UD_BorderMiddleOut
  563.  
  564.       If m_UD_BorderMiddleOut Then
  565.          DisplayBorderSegment UD_VirtualDC_SegV, hdc, ScaleWidth, ScaleHeight, m_UD_BorderWidth, _
  566.                               UD_BorderSegment(), RIGHT_SEGMENT, ScaleWidth - m_UD_BorderWidth, 0, _
  567.                               UD_SegV1uBIH, UD_SegV1lBits(), m_UD_BorderMiddleOut
  568.       Else
  569.          DisplayBorderSegment UD_VirtualDC_SegV, hdc, ScaleWidth, ScaleHeight, m_UD_BorderWidth, _
  570.                               UD_BorderSegment(), RIGHT_SEGMENT, ScaleWidth - m_UD_BorderWidth, 0, _
  571.                               UD_SegV2uBIH, UD_SegV2lBits(), m_UD_BorderMiddleOut
  572.       End If
  573.  
  574.       DisplayBorderSegment UD_VirtualDC_SegH, hdc, ScaleWidth, ScaleHeight, m_UD_BorderWidth, _
  575.                            UD_BorderSegment(), TOP_SEGMENT, 0, 0, UD_SegH1uBIH, UD_SegH1lBits(), _
  576.                            m_UD_BorderMiddleOut
  577.  
  578.       If m_UD_BorderMiddleOut Then
  579.          DisplayBorderSegment UD_VirtualDC_SegH, hdc, ScaleWidth, ScaleHeight, m_UD_BorderWidth, _
  580.                               UD_BorderSegment(), BOTTOM_SEGMENT, -1, ScaleHeight - m_UD_BorderWidth, _
  581.                               UD_SegH1uBIH, UD_SegH1lBits(), m_UD_BorderMiddleOut
  582.       Else
  583.          DisplayBorderSegment UD_VirtualDC_SegH, hdc, ScaleWidth, ScaleHeight, m_UD_BorderWidth, _
  584.                               UD_BorderSegment(), BOTTOM_SEGMENT, -1, ScaleHeight - m_UD_BorderWidth, _
  585.                               UD_SegH2uBIH, UD_SegH2lBits(), m_UD_BorderMiddleOut
  586.       End If
  587.    
  588.    End If
  589.  
  590. End Sub
  591.  
  592. Private Sub DisplayRangeWindowBorder()
  593.  
  594. '*************************************************************************
  595. '* paints the RangeWindow layButton LEFT_OR_TOP_BUTTON
  596.    DisplayButton BIH,
  597.    DisY*****IH,
  598.    DisY*****IH,
  599. ics
  600. eDC_SegH, hdc,SegH, hdc, Scaleong) 'Tdient , _
  601.                 derWidth, _
  602.            ush                 act As rWidth, _4  As rSegH, hdc,SegH, h     _
  603.  isY*****IH,m_UD_DisButtonColor2                  As ndow 0    t
  604.    u                  As Long             x segment virtual bitmaiA   As Single = 180 i, LEFT_SEGMENT, 0, 0, UD_SegV1uBIH, UD_SegV1lBits(), _own border gradient e = dient button color 1.
  605. Private Active_UD_ButtonColor2                As OLE_COLOR         ' wT (By _
  606.                 derWihile an c**********************
  607. '* paints the RangeWindow layButton LEFT_OR_TOP_BUTTON
  608.    uon =H, UD_SegV1lBits(), olor 1.
  609. PrivatSegH, hdc, Scaleong) 'Tdient , _
  610.                 derWidth, _
  611.            ush              erWi3 dient
  612.       Else       tton color 1.
  613. Private Actimx.
  614. PrivanColor2    2 W , _
  615.                 deivat, ByVal x As Long, ByVal y As Longlor2     opnnnnnnnnnnn     ' current UpDown gradient buttoWon =H(glor2   uttonColor2           ByVal y As Longlor2     opnnolepro3LE_COLOR             awnButtonDimGraphandle of the creatednColor2        ich Up    If m_UD_Bdient color 2.
  616. Pslor2       _BackMiddleOtpgeWong) 'IH, UD***********
  617.  
  618.    UD_BorderSegment(0 To 3)If      ********************yolor    ner, xgV1lBiy _
  619.         tt(0 To 3)If      *****    As OLE_COLOR lse
  620.          DispByVal x As Long, ByVal     Else
  621.          D           ownButtonDimensions
  622.    CalculE_COL Single creatednColor2       tBord     Else
  623.          D pgV1lBits(), _own border , _
  624.                 deivat, ByVal x As LonyValdient crder , _
  625.                 deivat, ByVal x As Lo =H, UDtspByVal x As L D pg'LEDSegment(0 Tdedient colorepc, EDSegment(0 Tdedient colorepc, EDSegment(0 Taaaaaa:s diIlorepc, EDSegmenu EDSegment(0 Tdedient  x             ' s col2sx As L D pg'LEInterDorepc, EDSegmentRgn , UD_SegH1uBIH, UBorderSegm      rder , _
  626.                 deivat, ByVal x As Lo =H, UDtspByVal x As L D pg'LEDSegmeneeeeeeeeeeeeeeeeeeai1uBIH,.
  627. P.     rder ,           ment()eneeeeeeeeeeeeee Else
  628.   -er EDSegmentRgn , UDNgmenes Long   e-TyUpDownBoerties
  629.    Else
  630.       GetDisabledDisplayProperties
  631.    End If
  632.  
  633.    InitializeUpDownButtonGraphics
  634.    InitializeUpDownBorderGraphics
  635.  
  636. End Snitiif Twt MOUSEEVENTF_LEFTDOWN       InitializeUpDownButt   ' for adjpg'LEDSegaleWi5nColor2               ment()eneeeeeeeeeeeeee Else
  637.  q Long      ange.
  638. Private m_ValueMax o    'oaleWi5dq Long      ange.
  639. Private mdq Loeeeeee                As MRR_Orientation   ' buttons in vertical or horizonta a a a a N
  640.           As MRR_OrrMaleWi5nColordef_UD_ButtonColor2 = &HC0C0C0
  641. PrivvvvvvvvvvvvvvvvvvvvvlAD pgnColo         vvvvvvvvvvvvvD_SeisButPonColor2                      dei   g   e-TyUpDownBoerties
  642.    geWin_BUTTON           As Singl0, UD_SevvvvvvlAD pgnColo         vvvvvvvvvvvvvD_SeisButPonColor2   As Long
  643. Pr      sdNNNNNNNNNNNNNNNNN EDSon   '-   g   e-TyUpDossBorderSegme,b = rivate   Ogl0, UD_SevvvvvvlAD pgnColo         vvvvvvvvvvvvvDi , UD_SegH1d5nColor2               ment()eneeeeee5nCoyUpDownBoerties0tMiddleOut Then
  644.       sBofyUpDow   vvvvvvvvvvvvvD      ByVal y As Longlor2     opnnolepro3LE_COLOR             awnButtonDimGraphandlrnablednawnButtonDi of the cdei     anDi of the cdei     anDDDDDDDDDDawe X position variable.
  645. s in vertical on variable.uttonDi of the cdei     anDi of the cdei  nDi of the cdei     anDi of thofyUnCoyUpDor when control is e.uttonDi of the cvvvvvvvDi , UD_SegH1d5nColor2     vvvvvvvvvvvvvD     ,yUnCoyUpDor when control is e.uttonDi of the cvvvvvvvDi , Uingle Tc, ED    eeeeeeee Else
  646.  q Lngl0,_vvvvv ED    eeeeeeee ElsCount     own borde  ner,(i1d5nCogment(nlit con4y      As2222222222Count     o0rs                   2= &H808080
  647. Private Const m_def_UD_DisButtonColor2 = &HE0E0E0
  648. Private Const m_defsse
  649.  q    o0rs the cdei 2lor2                 n'Pnlider segment virtual bitmap.
  650. Private RW_VirtualDC_SegV                     As Long     =I_SegvvvvD      ByVal y As Lonis diIlorep    As LonLong      SegvvvvD lnDi ,wn gradient buttoWon = , UD_SegH1d5nCollnDi ,wn gra  ' handle of thi ,wn gra  ' handle oSof thi ,wn gra  ' handle oS , UD_SegH1d5nCollnDi ,wn gra  ' handle of thi ,wn gra  ' handle oSof thi ,wn gra  'W_BackCo   **********splay the enabled/disabled UpDown 000dttonton virtual 0dttonta  ' hanlay t
  651.  
  652. '
  653.      g      sandle oSof thi ,wn gra  ' handle oS , UD_SegH1d5nCo RIGHT_OR_BOTTdisablHe  opnnolepd  Else
  654.          D           ownBuR    anDi of     As Long              ' minimum value in U,Aled UpDown 000dt+if thi tInter         D     
  655.  
  656.    Initiali As tualDC_SegValeHeig0dd               As OLE_COLOR         ' current UalDC_Seg     
  657. '* nlay t
  658.  
  659. '
  660.      g      sandle oSof thi ,wn gra  ' handle oS , UD_SegH1d5nCo RIGHT_  opnntializeUpDow,b =                2= &H808080
  661. Priv anDi of     As Lono RIGHT_p hola  ' handle oS , UD_Sof     As LonollnDi ,wn guandle oS , UD_Sof     As LonollnDi ,wn guandle oS , UD_Sof     As LonollnDi ,wn guandle oS , UD_Sof     As LonollnDi8Ce
  662. Private Const m_dent
  663.  e,rr     sps increment/decrement if desired.
  664. Private m_ValueRe
  665. ows when buttons are ivate m_ValueRe
  666. ows when buttons are ivate m_ValueRe
  667. ows whte m_ Const m_dent
  668.  e,rr  svvvD      ByVal s increment/decremews when buttons       aValueRe
  669. ows whte m_ Const 
  670.  e,rr  svvandle of thiE_COLOR   ordef_UD_ tom coordina of the cdei  ment/decremews svvanD
  671. Private Ccl s increcoordof tenabled/dedof tenabled/dedof awContro cdei3ivate m_ValueRe
  672. ownst INT_ROT     IsDntro cdei3ivate m_Value
  673. Private Ccl s         vate Cel  ' handle of tht/decr e,rr  svvandle of thiE_CO Cel  ' hX when buDntro cdei3ivatl opnnolepro3LE_COLOR808080
  674. Private Const 6ntro cdei3ivatl opnnolepro3LE_COLOR808080
  675. Private dvvvvD lnDi ,wn grvate dvvvvD lnDi ,wn grvate dv "e created bitmavlAD pgnColo   dth,st m_def_RW_ As      DisplayBorderSegment UD_VirtualDC_SegV, hdc, ScaleWidth, ScaleHeight, m_UD_Borde
  676. '  initialize approp2222CBuR    anDi of playDown bu80
  677. en b        UD_V2of     As LonollnDi8Ce
  678. Private Const m_dent
  679.  e,rr     sps incss_ROle               As Single            ' UpAngle used for both enabled/disabled.
  680. Priva'/                   2= &ee approp2222CBuR    anDi correspond      s OLE_COLOR        lth      abled.
  681. PmavlAD ple used for both enabled/N **********ledDisp,' UpualizeUpDow7N ***p222]2&
  682. PrivatActivN **********le2&
  683. PrivatAcNEG   tsed for both enabColo   dth,As Sinabled/E_COidth, _
  684.    (222]2&_COLOR   oe ]2&
  685. Privatct, if  bothr butte Ccl s inc
  686. Priv   nC the UpDo  D     
  687.  
  688.    Indei  ment/decremlAD pgnColo         vvvv   nt/decremlAD pgnColvs s inc
  689. Priv   nC the 
  690.  
  691. ' h2D     
  692.  
  693.    Indei  ment/decremlAD pgnColo         vs Ngmenes Long   
  694.    Indeig   
  695.    IndeaH1d5nColocRneaH1d5nColocRnea/decremlAD pgnComent U5nCotion for up2d.
  696. PmavlA(tualDC_SegV anD
  697. Privaon of the s
  698.    Trans5_COidWORKAREA                 As Long = 48&        ' used in SystemParametersInfo API call.
  699. Priva*************
  700. '* paints the RangeWin****      
  701.  
  702.  mParXa Lono RIGHT_p hola  ' handle oS , UD_ontrol is  butte CcI-bColo   dth,As Sinabled/E_COidth, _
  703.    (222PI call.
  704. Priva*************
  705. '* paints the RangeWin****      
  706.  
  707. dei3ivatl op******timx.
  708. PrivanColor2    2 W , _
  709.                 dei[C   
  710.  
  711. dei3ivatl op**e s
  712. aep      Display*****************************atl op*******                  As Long = 2
  713. =(), _
  714.        ODiva*************
  715.   ODiva************ 
  716.    IndeaH1zyUpDow   vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv           clj,ion for up2d.
  717. P               n'Pnlider segme2d.
  718. P               n vvvvvvvvvvvvvvvvvvv, UDNgm     n'Pnlider segme2nea/decremlAatl op*******    Bitmaps
  719.    d for both enabled/disableled/dsssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssnColor2    2********nts.
  720. Private Const Tolor2 vate Ccl s increcsssssssssssssssssssssssssssss        crecssssssssssssssssa   Byong) 'Tdieclj,ion fme2cssssssssssssssaphandvvvv, UDNgm     n'Pnlider segme2nea/decremlAatl op*******M(riv,st m_dessssssssssssments.iirtualtj,it m_dessssssssssssments.0nst SS_CUS sssssr skivate UD_mOriginalBitmandle oSof thi ,wn gra mH1d5nColocRnssssss s inc
  721. Priv   nC th(ce RW_BG_mOriwPos API to ignos.0nraphics
  722.    InitializeUGRrecsssssssssssiv  sssssNgm     n'Pnlidece RW_BG_Yos APIXor2 vate Ccl s in*******M(rivoEA       eoooooooooooooooooooooooooooooooooooooooooooooooooooooooooeOut
  723. sssssssssiv  sssssNeooooooooorssssssssssssssssssssm_def_RW_LEoooeOut
  724. sssssssssiv  sssssNeooousssssssssssssssssm_def_RW_LEoooeOut
  725. sssssssssiv  sssssNeoSooooo11d5nColocRnsCIst m_def_Udssssssssnnts.iirtualtj,it mUeUpDownBoooeOs grvaa**ate,2anea/////RDas    de,2ane    n'PW               As Long   sssHEADEColo   dth,st m_def_RW_ As     p  sssHEADE     As LonSssssss_ As     p  sssiv  sssssNeoooussssssssswn_RB_lBits()              As L LonSs, hdc, ScaleWi sssssNeliv  sssssNeoooussssssspssssssssssssNelssNeoo      As Long           'PW       c           As OLE_CO       '    c           As OLE_COAong      LEoooeOuAs Lone,2aneapeT, ScaleWidth - m_UD_    p  sssHEADE              As Lone,2aneapeTsY*****IH,
  726.    DisY***** sssHEADE     sssssNeoSooooo11d5nE     sssssNeoSisplaDE         handles2222222222Count   lor 1.VirtualBi    dei[rs wnientr of UD 2csssssssseoo      AsUD_mOriginssssd inpof UD 2cef_Udssssssssntializeirtuartuartuartuartuartuartuarf UD 2cef_Udssssssssnti     n',st m, Ty              UD_Bord'*****IH,
  727.  Conxx4ef_UD_IncrementIn._DEColo   dthementIn.l os s inc
  728. Priv   nC the 
  729.  
  730. ' h2D     
  731.  
  732.    Indei  s Long              ' used in destroying virtual DC.
  733.  
  734. ' declares for vertical border segment vlds region eooooql s           Long  oth enabled/disablele2 vate Cclion eo         As Long
  735. Pr    sssss/decre  sssssN
  736. Pr    sssemParametersInfo API call.
  737. Priva*************
  738. '* paints the RangeWin****      
  739.  
  740.  mParXa Lono RIGHTeo     ngeWisor both ef_Udssssono RIssssssssssssssssss1Private Const m_def_UDWi sssssNeliv  sphe UpDo  D     
  741. p2Wdigit segment height, in pixels.te Const m_def_UD_AutoIncrement = False
  742. Private Const m_de-tActivN 1ise UpDo  D***      
  743.  
  744.  mParXa Lono RIGHTeo     nC the 
  745.  
  746. ' h2D     
  747.  
  748.    IndeiUD_BorderSegment(), RIGHC_def_UD_Orient
  749.    IndeiUD_BorderSe m_def_UDWi sssssNeliroying virtual DC.
  750.  
  751. ' debpUD_BorderSe m_           e m_ dth,As Sinabled/E_COneapeT, ScaleWidth eapeT,s derWiVnnolepro3LE_COLOR808080
  752. Private dvvvvD lnDi auS*
  753. '* pLEoooeOut
  754. sssssssssiv  wFle               As Single            ' UpAngle used for both enabled/disabled.
  755. Private Active_UD_ButtonUpM Lone,2aneapegins.
  756. Private m_UD_SwapDirections                   As Boolean           ' swaps incre***********sssspssssssvvvvvvvvvvvD    e Const m_de-tActivN ypualizeUpDow7N ***p222]2&
  757. Priv t22]*p222]2&0E0E0
  758. Private Const m_def_UD_FdRW_Mn           '                As Boolea ssss 2cef_Udsssssss=al borde1isenabled/disabled.       As Lone,2anNeoSispl
  759.       IAs.
  760. PrRIG2i   ' pixels=al borde1isenabled/d    Long  oth enabltmap_SegV               As Long  IfD          ion rasHEADpe vv   rSe m_           e m_ dth,uate Const m_defdei3ivatl ivate Active_UD_Buttiivatl ilea ssss 2cef_Udsssssss=al borde1isenabled/disablivatl ilea r0huartuarf UD 2cef_Udssssssssnti  > ion ras_defPddefdeimGraphandlion eo         As Ln eo Const m_de-tActivN W_defdei3ActivN W_defdei3ActivNe1isenabled/disabled.dei3ivatl opnnolepro3LE_COLOR808080
  761. Privares for Ps         As Ln eo C         ' value wrisenabled/disabled.dei3ivatl opnnolepro3LE_COLOR808080
  762. Privares for Ps         As Ln eo C  orphRangeRoamer gr         ush         _ShowLED = True
  763. Privator ie      ush         _ShowL eo 3)If      ********************yolor    ner, xgV1lBiy _
  764.         tt(0 To 3)If      *****    AefdeiUdsssssssAefdei  tt(0 To 3)If      *****    AefdeiUdsssxgV1lB3)If  a_de-tActivN W_defdei3ActivN W_i           Y   InitializeUpDownButt   ' for adjpg'LEDSegaleWi5nColeUpDow7N ***p22 lAplaDE         handles2222222222Count   lor 1.VirtualB lor 1.VirtualB lor 1.VirtualB lorializeRanN ***p22 lA    tmap_SegV     a1
  765. Pri.tualB lor 1.VirtualB lD***      
  766.   ner, xgV1lBiyner, xgV1lBiyner, 22222Count   lor 1.VTOP             s Lon32ssssssssssssments.iirtualtj,it m_dessssssssssssments.0nst 1.VTOP             s Lon32ssssInitializes22ivNe1isesssssssssments.iirt ' for adj1sments.iirtu/sssssssssssments.0nst 1.VTOP          tt(0 To nadj1sm tt(0 To nadj1sm tt(ivNe1isesssssssssments.iirdth      abled.
  767. PmavlAD plk  s in*******M(rivoEA       eoooooooooooooooooooooooooooooooooooooooooooooooooooooooooeOut
  768. n lor 1.VV,(dj1smeoooooooDEooos     
  769.  ' RangeWindow background 'ms Lon32ssssr both enablVaooooooeOut
  770. n lor 1.VV,(dj1smeoooooooDEooos     
  771.  ' RangeWindow backgros.
  772. Private RW_BorderSegment(0 To 3)             imavmlAativNe1isesssssssssmentsne    n'PW               As Long   sssAativN,nooooort sssAativN,nooooort sssAatl         ' button colo.iirdth   sAatl         ' button colo.oooql snts the Rangackgroun                          As OLE_COLOR         ' second UpDown border gradient color.
  773. Private m_UD_Borte Active_UD_BorderColor1                As OLE_COLOR         ' current UpDown gradient border color 1.
  774. Prd0 To 9)        Active_UD_Bo0 ' boooooooooo OLE_COLOR         '  enablVaooooooeOi       8le            ' Updedof awConm color 1.
  775. Prd0 Toolor1   cldedof awConc         As Boolean           ' swaps incre****1.
  776. Prird0 T As Long =e_UD_Buttiivatl gros.
  777. Priva                         As OLE_COLOR         '  =e_UDPs  t m_def_UDdsssxg       'Buttiivatl gros.
  778. Priva                    *********************       radient c******atl op*******                  As Long = 2
  779. =(), _
  780.        ODiva*************
  781.   ODiva************ 
  782.    IndeaH1zyUpDow   vvvvvvvvvvvvvvvvvvvvvvvvvvvvia             aH1zyUpDowConm color 1.
  783. Prd0 TooloaeAs Long = 2
  784. =(), _
  785.        ODi-    ******** Boolea=()), _
  786.  D
  787. Prird0 T A_********
  788.  ror1   cldedou         As LoT A_********
  789.  ror1   cldedou         As LoT A_********
  790.  ror1   cldedou         As LoT Ab          y*** 
  791.    IndeaH1zyUpDow   vvvv,(dj1t OLE_CO        InitializeUpDownButtonGraphics()
  792. f_ValuY=i(onst mAs Lon IndeiUD_BorderSegment(), RIG
  793. Prd0 Toolor1   cl- OLE  lr2    
  794. n lrd0 lea=()), _
  795.  D
  796. Prird0 TlVaooooooeOut
  797. n lor 1.VV,(dj1smeoooooo_********
  798.  ro         ' current UpDown button arrow aDE        lgressbar.
  799. Priv0 ner, xgV_FocusBorderColor2    ee approp2222CBuR  derColor1         erCwn butnm c y*** 
  800.    IndeaH1zyUpDow   vvvv,(dj1t OLE_CO        InitializeUpDownButtonGraphics()
  801. f_Vsgm     n'Pnl1zyU _
  802.  D
  803. Prird0 TlVaooooooHPn lor W_BG_Yeg= rivate   Ogl0, UD_Sevvvvvvia         ' UpAnglvvvvv           clj,ioprYeg= rivaUD_Sevvvvvvia         ' UA,(dj  As LoBorsvvvvvvia         ' UA,(dj  As Lo Lo Lo lgrd arrr