home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Chat_Progr2043811212007.psc / chameleonButton.ctl < prev   
Text File  |  2006-12-25  |  62KB  |  1,591 lines

  1. VERSION 5.00
  2. Begin VB.UserControl chameleonButton 
  3.    AutoRedraw      =   -1  'True
  4.    ClientHeight    =   3600
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   4800
  8.    DefaultCancel   =   -1  'True
  9.    PropertyPages   =   "chameleonButton.ctx":0000
  10.    ScaleHeight     =   240
  11.    ScaleMode       =   3  '╣│»└
  12.    ScaleWidth      =   320
  13.    ToolboxBitmap   =   "chameleonButton.ctx":004A
  14.    Begin VB.Timer OverTimer 
  15.       Enabled         =   0   'False
  16.       Interval        =   3
  17.       Left            =   0
  18.       Top             =   0
  19.    End
  20. End
  21. Attribute VB_Name = "chameleonButton"
  22. Attribute VB_GlobalNameSpace = False
  23. Attribute VB_Creatable = True
  24. Attribute VB_PredeclaredId = False
  25. Attribute VB_Exposed = False
  26. Option Explicit
  27.  
  28. #Const isOCX = False
  29.  
  30. Private Const cbVersion As String = "2.0.6 B"
  31.  
  32. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  33. '%             <<< GONCHUKI SYSTEMS >>>               %
  34. '%                                                    %
  35. '%                 CHAMELEON BUTTON                   %
  36. '%         copyright ⌐2001-2003 by gonchuki           %
  37. '%                                                    %
  38. '%  this custom control will emulate the most common  %
  39. '%      command buttons that everyone knows.          %
  40. '%                                                    %
  41. '%  it took me three months to develop this control   %
  42. '% but that was a first step, now eight months after, %
  43. '%  it turned out to be a very professional control.  %
  44. '%                                                    %
  45. '%     ALL THE CODE WAS WRITTEN FROM SCRATCH!!!       %
  46. '%                                                    %
  47. '%   ever wanted to add cool buttons to your app???   %
  48. '%          this is the BEST solution!!!              %
  49. '%                                                    %
  50. '%        Copyright ⌐ 2001-2003 by gonchuki           %
  51. '%                                                    %
  52. '%    Commercial use of this control is FORBIDDEN     %
  53. '%          without registering first.                %
  54. '%    You can only use parts of this code for other   %
  55. '%  open source or freeware programs. Reuse of this   %
  56. '%  code in commercial applications is also FORBIDDEN %
  57. '%   You can use this code without asking for your    %
  58. '%  personal projects or for freeware, but remember   %
  59. '%           to give credits where its due            %
  60. '%                                                    %
  61. '%  you MUST NOT build nor distribute OCX controls    %
  62. '%   based on the Chameleon Button, doing so is       %
  63. '%               against this terms.                  %
  64. '%                                                    %
  65. '%PLEASE NOTICE THAT THIS IS NOW A COMMERCIAL PRODUCT %
  66. '% AND THIS SOURCE IS STILL BEING DISTRIBUTED IN PRO  %
  67. '%   OF THE OPEN-SOURCE COMMUNITY, DON'T BREAK ANY    %
  68. '%  OF MY STATED RULES OR I WILL STOP DISTRIBUTING    %
  69. '%  THIS FREE VERSION. IT IS UP TO YOU TO COMPLY WITH %
  70. '%    THE RULES AND SUPPORT OPEN-SOURCE PROGRAMS.     %
  71. '%                                                    %
  72. '%   FOR MORE INFORMATION ABOUT REGISTERING AND THE   %
  73. '%   LATEST RELEASE INFORMATION, PLEASE HEAD TO:      %
  74. '%              http://gonchuki.8m.com                %
  75. '%                                                    %
  76. '%            e-mail: gonchuki@yahoo.es               %
  77. '%                                                    %
  78. '%                  MADE IN URUGUAY                   %
  79. '%                                                    %
  80. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  81.  
  82. '######################################################
  83. '#                    UPDTATE LOG                     #
  84. '#  all times are GMT -03:00                          #
  85. '#                                                    #
  86. '# November 9  - 03:00 am                             #
  87. '#              ╖ first release                       #
  88. '#             - 05:00 pm                             #
  89. '#              ╖ added ShowFocusRect property        #
  90. '#              ╖ added repaint before triggering the #
  91. '#                click event                         #
  92. '#             - 07:20 pm                             #
  93. '#              ╖ fixed the color shifting so it will #
  94. '#                display the correct color and not a #
  95. '#                weird one.                          #
  96. '#              ╖ improved Java button drawing        #
  97. '#              ╖ added custom colors capability      #
  98. '#                now it looks better than ever COOL! #
  99. '#              ╖ improved Flat button drawing        #
  100. '#                                                    #
  101. '# November 13 - 03:40 pm                             #
  102. '#              ╖ fixed the WinXP button colors and   #
  103. '#                styles. Note that as the colors are #
  104. '#                relative to a base, and for this    #
  105. '#                button i made a color work-around,  #
  106. '#                some colors will be un-reachable    #
  107. '#              ╖ added MouseMove event as requested  #
  108. '#                                                    #
  109. '# November 18 - 10:40 am                             #
  110. '#              ╖ translated all the line methods to  #
  111. '#                API calls. It's now faster than     #
  112. '#                ever. It will also decrease the     #
  113. '#                extra size of your exe!!!           #
  114. '#              ╖ improved Win32 button drawing       #
  115. '#              ╖ moved the direct calls to SetPixel  #
  116. '#                to use less inline .hDC calls       #
  117. '#              ╖ fixed KeyDown/KeyUp events so they  #
  118. '#                now act as they should              #
  119. '#                                                    #
  120. '# November 23 - 3:55 pm  (not updating on PSC...)    #
  121. '#              ╖ upgraded version to 1.1             #
  122. '#              ╖ added FontBold, and other similar   #
  123. '#                properties as requested             #
  124. '#              ╖ greatly improved drawing speed by   #
  125. '#                replacing lots of duplicated code   #
  126. '#                with the new-brand function made by #
  127. '#                me: "DrawFrame"                     #
  128. '#              ╖ fixed MouseDown/MouseUp events so   #
  129. '#                they now act as they should         #
  130. '#              ╖ added MousePointer property         #
  131. '#                                                    #
  132. '# December 1  - 10:10 pm                             #
  133. '#              ╖ replaced the RECT types assignment  #
  134. '#                in the resize event with API calls  #
  135. '#                that take 3/4 the time of raw vb    #
  136. '#              ╖ added "use container" to the color  #
  137. '#                schemes                             #
  138. '#              ╖ button now initializes with it's    #
  139. '#                caption set as it's name            #
  140. '#                                                    #
  141. '# December 23 - 2:00 pm                              #
  142. '#              ╖ finally got all the code in API by  #
  143. '#                replacing the Usercontrol.ForeColor #
  144. '#                calls with CreatePen API            #
  145. '#              ╖ added support for wrapping captions #
  146. '#              ╖ changed a bit the XP button gradient#
  147. '#                thanks to Ghuran Kartal for this    #
  148. '#              ╖ added refresh sub to force a button #
  149. '#                redraw.                             #
  150. '#              ╖ MouseIcon property added            #
  151. '#              ╖ MouseOver/MouseOut events added and #
  152. '#                also a ForeOver property is provided#
  153. '#                to change font color on mouse over. #
  154. '#                this also fixed the WinXP button,   #
  155. '#                which design is now perfect.        #
  156. '#              ╖ added FlatHover button style that is#
  157. '#                the real toolbar button.            #
  158. '#                                                    #
  159. '# January 1  - 11:15 am                 year 2002!!! #
  160. '#              ╖ some minor fixes                    #
  161. '#              ╖ new release!!!                      #
  162. '#                                                    #
  163. '# January 5  - 10:15 am                              #
  164. '#              ╖ fixed the memory leaks (only 1% of  #
  165. '#                gdi is lost per 15-20 runs of demo) #
  166. '#              ╖ the font assignment has changed     #
  167. '#              ╖ fixed a very rare and random bug in #
  168. '#                the XP-button. Problem was in the   #
  169. '#                DrawLine sub. Thanks goes to Dennis #
  170. '#                Vanderspek                          #
  171. '#              ╖ changed Mid and LCase to the faster #
  172. '#                Mid$ and LCase$ way                 #
  173. '#                                                    #
  174. '# January 22  - 11:55 pm                             #
  175. '#              ╖ fixed the "not redrawing" bug under #
  176. '#                Win 2K/NT/ME.                       #
  177. '#              ╖ fixed a bug that prevented hot keys #
  178. '#                to work properly                    #
  179. '#              ╖ fixed the font alignment problem    #
  180. '#                many many thanks to Carles P.V.     #
  181. '#                                                    #
  182. '# February 6  - 4:15 pm                              #
  183. '#              ╖ fixed property assignment problems  #
  184. '#              ╖ fixed "Use Container" color scheme  #
  185. '#              ╖ optimized a bit the code            #
  186. '#              ╖ fixed problem with system colors    #
  187. '#              ╖ added SoftBevel prop to allow the   #
  188. '#                buton to be "flatter"               #
  189. '#                                                    #
  190. '# February 8  - 10:15 pm                             #
  191. '#              ╖ fixed click event when user double  #
  192. '#                clicks on the button                #
  193. '#                                                    #
  194. '# February 10 - 2:35 pm                              #
  195. '#              ╖ added Office XP button style        #
  196. '#              ╖ added "DrawCaption" sub for easier  #
  197. '#                caption management                  #
  198. '#              ╖ changed focus rects for flat buttons#
  199. '#              ╖ added "DisableRefresh" sub to allow #
  200. '#                property changes without repainting #
  201. '#                until needed to do so.              #
  202. '#              ╖ added BackOver property             #
  203. '#                                                    #
  204. '# February 11 - 1:15 am                              #
  205. '#              ╖ added primitive support for pictures#
  206. '#              ╖ fixed colors when mouse re-enters   #
  207. '#                button area while holding the mouse #
  208. '#                button.                             #
  209. '#                                                    #
  210. '# February 12 - 4:30 pm                              #
  211. '#              ╖ finished with the picture property! #
  212. '#              ╖ Java focus rect fixed               #
  213. '#              ╖ Office XP style fixed               #
  214. '#              ╖ Changed "ConvertFromSystemColor" sub#
  215. '#                                                    #
  216. '# February 14 - 6:20 pm                              #
  217. '#              ╖ replaced the transparent blitting   #
  218. '#                function with one 10 times better   #
  219. '#              ╖ joined bitmaps & icons drawing      #
  220. '#              ╖ added "UseGreyscale" option         #
  221. '#                                                    #
  222. '# February 18 - 4:30 pm                              #
  223. '#              ╖ added embossed/engraved/shadowed fx #
  224. '#              ╖ added category for each property    #
  225. '#              ╖ added standard property pages       #
  226. '#                                                    #
  227. '# March 3 - 9:10 pm                                  #
  228. '#              ╖ fixed effects for XP styles         #
  229. '#              ╖ added mouseover detection function  #
  230. '#              ╖ some minor adjustments              #
  231. '#                                                    #
  232. '# March 31 - 2:55 am                                 #
  233. '#              ╖ upgraded to version 2.0             #
  234. '#              ╖ added transparent, 3D Hover and     #
  235. '#                oval button types                   #
  236. '#                                                    #
  237. '# April 1 - 9:45 pm                                  #
  238. '#              ╖ fixed transparent button drawing    #
  239. '#                                                    #
  240. '# April 19 - 6:00 pm                                 #
  241. '#              ╖ fixed Ofice XP button colors        #
  242. '#              ╖ added built-in hand cursor          #
  243. '#                                                    #
  244. '# May 11 - 12:40 pm                                  #
  245. '#              ╖ added KDE 2 button style!           #
  246. '#              ╖ slightly optimized Mac button code  #
  247. '#                                                    #
  248. '# May 16 - 7:00 pm                                   #
  249. '#              ╖ added version property              #
  250. '#              ╖ added complilation options for lite #
  251. '#                version (evaluation purpose only)   #
  252. '#              ╖ some optimizations for drawing fx   #
  253. '#                                                    #
  254. '# May 22 - 5:20 pm                                   #
  255. '#              ╖ added some code to make more robust #
  256. '#                the lite version                    #
  257. '#              ╖ added background picture option     #
  258. '#                                                    #
  259. '# June 29 - 4:00 pm                                  #
  260. '#              ╖ added CheckBoxBehaviour option to   #
  261. '#                allow the button behave as one of em#
  262. '#                                                    #
  263. '# July 25 - 11:55 pm                                 #
  264. '#              ╖ slightly optimized code, specially  #
  265. '#                by removing the slow IIf's          #
  266. '#              ╖ corrected default state for KDE2    #
  267. '#                                                    #
  268. '# August 1 - 12:30 pm                                #
  269. '#              ╖ NEW PUBLIC RELEASE!!!    (ver 2.04) #
  270. '#            2:40 pm                           2.05  #
  271. '#              ╖ button was not updating when "value"#
  272. '#                prop was changed by the code. Thanks#
  273. '#                to Steve and uZiGuLa.               #
  274. '#              ╖ fixed drawing for Win32 button while#
  275. '#                being CheckBox and Value = True     #
  276. '#                                                    #
  277. '# August 2 - 11:30 pm                          2.0.6 #
  278. '#              ╖ fixed (i hope) the problem with the #
  279. '#                WinXP disabled picture              #
  280. '#              ╖ fixed the "not redrawing" problem   #
  281. '#                                                    #
  282. '# June 08, 2003 - 11:00 pm                   2.0.6 B #
  283. '#      ╖ THIS IS A BRANCHED VERSION FROM THE CURRENT #
  284. '#        SOURCE CODE, IT HAS BEEN DONE TO FIX A PAIR #
  285. '#        OF CRITICAL BUGS, SO AS TO CONTINUE WITH MY #
  286. '#        WELL DESERVED BRAND OF _QUALITY_.           #
  287. '#      CURRENT SOURCE CODE IS NOT EVEN CLOSE TO THIS #
  288. '#      AND MORE THAN A DOZEN OF SPECIFIC BUGS WERE   #
  289. '#      FIXED, AND SOME FEATURES WERE ADDED.          #
  290. '#      SPEED HAS BEEN EXTREMELY TWEAKED, SO IMPACT   #
  291. '#      IN PERFORMANCE IS NULL. ALL MEMORY LEAKS ARE  #
  292. '#      GONE, SO IT IS NOW A ROCK SOLID CONTROL.      #
  293. '#      THE FULL SOURCE FOR THE NEWEST VERSION IS     #
  294. '#      AVAILABLE ONCE YOU REGISTER AT:               #
  295. '#              http://gonchuki.8m.com                #
  296. '#                                                    #
  297. '#      ╖ fixed a problem with mask color under 16-bit#
  298. '#        screens.                                    #
  299. '#      ╖ caption now updates in real-time in the IDE #
  300. '#      ╖ fixed icon drawing in TransBlt              #
  301. '#      ╖ fixed transparent button issue. The solution#
  302. '#        used is rather old, and does not match the  #
  303. '#        actual one... however, it works fine.       #
  304. '#      ╖ used Ulli's code formatter for some better  #
  305. '#        readability.                                #
  306. '#                                                    #
  307. '######################################################
  308.  
  309. Private Declare Function SetPixel Lib "gdi32" Alias "SetPixelV" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
  310. Private Declare Function GetNearestColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
  311.  
  312. Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
  313. Private Const COLOR_HIGHLIGHT = 13
  314. Private Const COLOR_BTNFACE = 15
  315. Private Const COLOR_BTNSHADOW = 16
  316. Private Const COLOR_BTNTEXT = 18
  317. Private Const COLOR_BTNHIGHLIGHT = 20
  318. Private Const COLOR_BTNDKSHADOW = 21
  319. Private Const COLOR_BTNLIGHT = 22
  320.  
  321. Private Declare Function OleTranslateColor Lib "oleaut32.dll" (ByVal lOleColor As Long, ByVal lHPalette As Long, lColorRef As Long) As Long
  322. Private Declare Function GetBkColor Lib "gdi32" (ByVal hdc As Long) As Long
  323. Private Declare Function GetTextColor Lib "gdi32" (ByVal hdc As Long) As Long
  324. Private Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
  325. Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
  326. Private Const DT_CALCRECT = &H400
  327. Private Const DT_WORDBREAK = &H10
  328. Private Const DT_CENTER = &H1 Or DT_WORDBREAK Or &H4
  329.  
  330. Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
  331. Private Declare Function FillRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
  332. Private Declare Function FrameRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
  333. Private Declare Function DrawFocusRect Lib "user32" (ByVal hdc As Long, lpRect As RECT) As Long
  334. Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  335.  
  336. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  337. Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
  338.  
  339. Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, lpPoint As POINTAPI) As Long
  340. Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
  341. Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
  342. Private Const PS_SOLID = 0
  343.  
  344. Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  345. Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  346. Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
  347. Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
  348. Private Const RGN_DIFF = 4
  349.  
  350. Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
  351. Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
  352. Private Declare Function InflateRect Lib "user32" (lpRect As RECT, ByVal X As Long, ByVal Y As Long) As Long
  353. Private Declare Function OffsetRect Lib "user32" (lpRect As RECT, ByVal X As Long, ByVal Y As Long) As Long
  354. Private Declare Function CopyRect Lib "user32" (lpDestRect As RECT, lpSourceRect As RECT) As Long
  355.  
  356. Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
  357. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  358.  
  359. Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
  360.  
  361. Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
  362. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
  363. Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
  364.  
  365. Private Declare Function GetDIBits Lib "gdi32" (ByVal aHDC As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BITMAPINFO, ByVal wUsage As Long) As Long
  366. Private Declare Function SetDIBitsToDevice 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 Scan As Long, ByVal NumScans As Long, Bits As Any, BitsInfo As BITMAPINFO, ByVal wUsage As Long) As Long
  367.  
  368. Private 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
  369. Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
  370. Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  371. Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
  372. Private 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 cyWidth As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal diFlags As Long) As Long
  373. Private 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
  374. Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
  375.  
  376. Private Type RECT
  377.     Left As Long
  378.     Top As Long
  379.     Right As Long
  380.     Bottom As Long
  381. End Type
  382.  
  383. Private Type POINTAPI
  384.     X As Long
  385.     Y As Long
  386. End Type
  387.  
  388. Private Type BITMAPINFOHEADER
  389.     biSize As Long
  390.     biWidth As Long
  391.     biHeight As Long
  392.     biPlanes As Integer
  393.     biBitCount As Integer
  394.     biCompression As Long
  395.     biSizeImage As Long
  396.     biXPelsPerMeter As Long
  397.     biYPelsPerMeter As Long
  398.     biClrUsed As Long
  399.     biClrImportant As Long
  400. End Type
  401.  
  402. Private Type RGBTRIPLE
  403.     rgbBlue As Byte
  404.     rgbGreen As Byte
  405.     rgbRed As Byte
  406. End Type
  407.  
  408. Private Type BITMAPINFO
  409.     bmiHeader As BITMAPINFOHEADER
  410.     bmiColors As RGBTRIPLE
  411. End Type
  412.  
  413. Public Enum ButtonTypes
  414.     [Windows 16-bit] = 1    'the old-fashioned Win16 button
  415.     [Windows 32-bit] = 2    'the classic windows button
  416.     [Windows XP] = 3        'the new brand XP button totally owner-drawn
  417.     [Mac] = 4               'i suppose it looks exactly as a Mac button... i took the style from a GetRight skin!!!
  418.     [Java metal] = 5        'there are also other styles but not so different from windows one
  419.     [Netscape 6] = 6        'this is the button displayed in web-pages, it also appears in some java apps
  420.     [Simple Flat] = 7       'the standard flat button seen on toolbars
  421.     [Flat Highlight] = 8    'again the flat button but this one has no border until the mouse is over it
  422.     [Office XP] = 9         'the new Office XP button
  423.     '[MacOS-X] = 10         'this is a plan for the future...
  424.     [Transparent] = 11      'suggested from a user...
  425.     [3D Hover] = 12         'took this one from "Noteworthy Composer" toolbal
  426.     [Oval Flat] = 13        'a simple Oval Button
  427.     [KDE 2] = 14            'the great standard KDE2 button!
  428. End Enum
  429.  
  430. Public Enum ColorTypes
  431.     [Use Windows] = 1
  432.     [Custom] = 2
  433.     [Force Standard] = 3
  434.     [Use Container] = 4
  435. End Enum
  436.  
  437. Public Enum PicPositions
  438.     cbLeft = 0
  439.     cbRight = 1
  440.     cbTop = 2
  441.     cbBottom = 3
  442.     cbBackground = 4
  443. End Enum
  444.  
  445. Public Enum fx
  446.     cbNone = 0
  447.     cbEmbossed = 1
  448.     cbEngraved = 2
  449.     cbShadowed = 3
  450. End Enum
  451.  
  452. Private Const FXDEPTH As Long = &H28
  453.  
  454. 'events
  455. Public Event Click()
  456. Attribute Click.VB_UserMemId = -600
  457. Attribute Click.VB_MemberFlags = "200"
  458. Public Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  459. Public Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  460. Public Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  461. Public Event KeyPress(KeyAscii As Integer)
  462. Public Event KeyDown(KeyCode As Integer, Shift As Integer)
  463. Public Event KeyUp(KeyCode As Integer, Shift As Integer)
  464. Public Event MouseOver()
  465. Public Event MouseOut()
  466.  
  467. 'variables
  468. Private MyButtonType As ButtonTypes
  469. Private MyColorType As ColorTypes
  470. Private PicPosition As PicPositions
  471. Private SFX As fx 'font and picture effects
  472.  
  473. Private He As Long  'the height of the button
  474. Private Wi As Long  'the width of the button
  475.  
  476. Private BackC As Long 'back color
  477. Private BackO As Long 'back color when mouse is over
  478. Private ForeC As Long 'fore color
  479. Private ForeO As Long 'fore color when mouse is over
  480. Private MaskC As Long 'mask color
  481. Private OXPb As Long, OXPf As Long
  482. Private useMask As Boolean, useGrey As Boolean
  483. Private useHand As Boolean
  484.  
  485. Private picNormal As StdPicture, picHover As StdPicture
  486. Private pDC As Long, pBM As Long, oBM As Long 'used for the treansparent button
  487.  
  488. Private elTex As String     'current text
  489.  
  490. Private rc As RECT, rc2 As RECT, rc3 As RECT, fc As POINTAPI 'text and focus rect locations
  491. Private picPT As POINTAPI, picSZ As POINTAPI  'picture Position & Size
  492. Private rgnNorm As Long
  493.  
  494. Private LastButton As Byte, LastKeyDown As Byte
  495. Private isEnabled As Boolean, isSoft As Boolean
  496. Private HasFocus As Boolean, showFocusR As Boolean
  497.  
  498. Private cFace As Long, cLight As Long, cHighLight As Long, cShadow As Long, cDarkShadow As Long, cText As Long, cTextO As Long, cFaceO As Long, cMask As Long, XPFace As Long
  499.  
  500. Private lastStat As Byte, TE As String, isShown As Boolean  'used to avoid unnecessary repaints
  501. Private isOver As Boolean, inLoop As Boolean
  502.  
  503. Private Locked As Boolean
  504.  
  505. Private captOpt As Long
  506. Private isCheckbox As Boolean, cValue As Boolean
  507.  
  508. Private Sub OverTimer_Timer()
  509.  
  510.     If Not isMouseOver Then
  511.         OverTimer.Enabled = False
  512.         isOver = False
  513.         Call Redraw(0, True)
  514.         RaiseEvent MouseOut
  515.     End If
  516.  
  517. End Sub
  518.  
  519. Private Sub UserControl_AccessKeyPress(KeyAscii As Integer)
  520.  
  521.     LastButton = 1
  522.     Call UserControl_Click
  523.  
  524. End Sub
  525.  
  526. Private Sub UserControl_AmbientChanged(PropertyName As String)
  527.  
  528.     Call SetColors
  529.     Call Redraw(lastStat, True)
  530.  
  531. End Sub
  532.  
  533. Private Sub UserControl_Click()
  534.  
  535.     If LastButton = 1 And isEnabled Then
  536.         If isCheckbox Then cValue = Not cValue
  537.         Call Redraw(0, True) 'be sure that the normal status is drawn
  538.         UserControl.Refresh
  539.         RaiseEvent Click
  540.     End If
  541.  
  542. End Sub
  543.  
  544. Private Sub UserControl_DblClick()
  545.  
  546.     If LastButton = 1 Then
  547.         Call UserControl_MouseDown(1, 0, 0, 0)
  548.         SetCapture hwnd
  549.     End If
  550.  
  551. End Sub
  552.  
  553. Private Sub UserControl_GotFocus()
  554.  
  555.     HasFocus = True
  556.     Call Redraw(lastStat, True)
  557.  
  558. End Sub
  559.  
  560. Private Sub UserControl_Hide()
  561.  
  562.     isShown = False
  563.  
  564. End Sub
  565.  
  566. Private Sub UserControl_Initialize()
  567.  
  568. 'this makes the control to be slow, remark this line if the "not redrawing" problem is not important for you: ie, you intercept the Load_Event (with breakpoint or messageBox) and the button does not repaint...
  569.  
  570.     isShown = True
  571.  
  572. End Sub
  573.  
  574. Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer)
  575.  
  576.     RaiseEvent KeyDown(KeyCode, Shift)
  577.  
  578.     LastKeyDown = KeyCode
  579.     Select Case KeyCode
  580.     Case 32 'spacebar pressed
  581.         Call Redraw(2, False)
  582.     Case 39, 40 'right and down arrows
  583.         SendKeys "{Tab}"
  584.     Case 37, 38 'left and up arrows
  585.         SendKeys "+{Tab}"
  586.     End Select
  587.  
  588. End Sub
  589.  
  590. Private Sub UserControl_KeyPress(KeyAscii As Integer)
  591.  
  592.     RaiseEvent KeyPress(KeyAscii)
  593.  
  594. End Sub
  595.  
  596. Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer)
  597.  
  598.     RaiseEvent KeyUp(KeyCode, Shift)
  599.  
  600.     If (KeyCode = 32) And (LastKeyDown = 32) Then 'spacebar pressed, and not cancelled by the user
  601.         If isCheckbox Then cValue = Not cValue
  602.         Call Redraw(0, False)
  603.         UserControl.Refresh
  604.         RaiseEvent Click
  605.     End If
  606.  
  607. End Sub
  608.  
  609. Private Sub UserControl_LostFocus()
  610.  
  611.     HasFocus = False
  612.     Call Redraw(lastStat, True)
  613.  
  614. End Sub
  615.  
  616. Private Sub UserControl_InitProperties()
  617.  
  618.     isEnabled = True: showFocusR = True: useMask = True
  619.     elTex = Ambient.DisplayName
  620.     Set UserControl.Font = Ambient.Font
  621.     MyButtonType = [Windows 32-bit]
  622.     MyColorType = [Use Windows]
  623.     Call SetColors
  624.     BackC = cFace: BackO = BackC
  625.     ForeC = cText: ForeO = ForeC
  626.     MaskC = &HC0C0C0
  627.     Call CalcTextRects
  628.  
  629. End Sub
  630.  
  631. Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  632.  
  633.     RaiseEvent MouseDown(Button, Shift, X, Y)
  634.     LastButton = Button
  635.     If Button <> 2 Then Call Redraw(2, False)
  636.  
  637. End Sub
  638.  
  639. Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  640.  
  641.     RaiseEvent MouseMove(Button, Shift, X, Y)
  642.     If Button < 2 Then
  643.         If Not isMouseOver Then
  644.             'we are outside the button
  645.             Call Redraw(0, False)
  646.         Else
  647.             'we are inside the button
  648.             If Button = 0 And Not isOver Then
  649.                 OverTimer.Enabled = True
  650.                 isOver = True
  651.                 Call Redraw(0, True)
  652.                 RaiseEvent MouseOver
  653.             ElseIf Button = 1 Then
  654.                 isOver = True
  655.                 Call Redraw(2, False)
  656.                 isOver = False
  657.             End If
  658.         End If
  659.     End If
  660.  
  661. End Sub
  662.  
  663. Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  664.  
  665.     RaiseEvent MouseUp(Button, Shift, X, Y)
  666.     If Button <> 2 Then Call Redraw(0, False)
  667.  
  668. End Sub
  669.  
  670. '########## BUTTON PROPERTIES ##########
  671. Public Property Get BackColor() As OLE_COLOR
  672. Attribute BackColor.VB_ProcData.VB_Invoke_Property = ";Appearance"
  673. Attribute BackColor.VB_UserMemId = -501
  674.  
  675.     BackColor = BackC
  676.  
  677. End Property
  678.  
  679. Public Property Let BackColor(ByVal theCol As OLE_COLOR)
  680.  
  681.     BackC = theCol
  682.     If Not Ambient.UserMode Then BackO = theCol
  683.     Call SetColors
  684.     Call Redraw(lastStat, True)
  685.     PropertyChanged "BCOL"
  686.  
  687. End Property
  688.  
  689. Public Property Get BackOver() As OLE_COLOR
  690. Attribute BackOver.VB_ProcData.VB_Invoke_Property = ";Appearance"
  691.  
  692.     BackOver = BackO
  693.  
  694. End Property
  695.  
  696. Public Property Let BackOver(ByVal theCol As OLE_COLOR)
  697.  
  698.     BackO = theCol
  699.     Call SetColors
  700.     Call Redraw(lastStat, True)
  701.     PropertyChanged "BCOLO"
  702.  
  703. End Property
  704.  
  705. Public Property Get ForeColor() As OLE_COLOR
  706. Attribute ForeColor.VB_ProcData.VB_Invoke_Property = ";Appearance"
  707. Attribute ForeColor.VB_UserMemId = -513
  708.  
  709.     ForeColor = ForeC
  710.  
  711. End Property
  712.  
  713. Public Property Let ForeColor(ByVal theCol As OLE_COLOR)
  714.  
  715.     ForeC = theCol
  716.     If Not Ambient.UserMode Then ForeO = theCol
  717.     Call SetColors
  718.     Call Redraw(lastStat, True)
  719.     PropertyChanged "FCOL"
  720.  
  721. End Property
  722.  
  723. Public Property Get ForeOver() As OLE_COLOR
  724. Attribute ForeOver.VB_ProcData.VB_Invoke_Property = ";Appearance"
  725.  
  726.     ForeOver = ForeO
  727.  
  728. End Property
  729.  
  730. Public Property Let ForeOver(ByVal theCol As OLE_COLOR)
  731.  
  732.     ForeO = theCol
  733.     Call SetColors
  734.     Call Redraw(lastStat, True)
  735.     PropertyChanged "FCOLO"
  736.  
  737. End Property
  738.  
  739. Public Property Get MaskColor() As OLE_COLOR
  740. Attribute MaskColor.VB_ProcData.VB_Invoke_Property = ";Appearance"
  741.  
  742.     MaskColor = MaskC
  743.  
  744. End Property
  745.  
  746. Public Property Let MaskColor(ByVal theCol As OLE_COLOR)
  747.  
  748.     MaskC = theCol
  749.     Call SetColors
  750.     Call Redraw(lastStat, True)
  751.     PropertyChanged "MCOL"
  752.  
  753. End Property
  754.  
  755. Public Property Get ButtonType() As ButtonTypes
  756. Attribute ButtonType.VB_ProcData.VB_Invoke_Property = ";Appearance"
  757.  
  758.     ButtonType = MyButtonType
  759.  
  760. End Property
  761.  
  762. Public Property Let ButtonType(ByVal newValue As ButtonTypes)
  763.  
  764.     MyButtonType = newValue
  765.     If MyButtonType = [Java metal] And Not Ambient.UserMode Then
  766.         UserControl.FontBold = True
  767.     ElseIf MyButtonType = 11 And isShown Then
  768.         Call GetParentPic
  769.     End If
  770.     Call UserControl_Resize
  771.     PropertyChanged "BTYPE"
  772.  
  773. End Property
  774.  
  775. Public Property Get Caption() As String
  776. Attribute Caption.VB_ProcData.VB_Invoke_Property = ";Text"
  777. Attribute Caption.VB_UserMemId = -518
  778.  
  779.     Caption = elTex
  780.  
  781. End Property
  782.  
  783. Public Property Let Caption(ByVal newValue As String)
  784.  
  785.     elTex = newValue
  786.     Call SetAccessKeys
  787.     Call CalcTextRects
  788.     Call Redraw(0, True)
  789.     PropertyChanged "TX"
  790.  
  791. End Property
  792.  
  793. Public Property Get Enabled() As Boolean
  794. Attribute Enabled.VB_ProcData.VB_Invoke_Property = ";Behavior"
  795. Attribute Enabled.VB_UserMemId = -514
  796.  
  797.     Enabled = isEnabled
  798.  
  799. End Property
  800.  
  801. Public Property Let Enabled(ByVal newValue As Boolean)
  802.  
  803.     isEnabled = newValue
  804.     Call Redraw(0, True)
  805.     UserControl.Enabled = isEnabled
  806.     PropertyChanged "ENAB"
  807.  
  808. End Property
  809.  
  810. Public Property Get Font() As Font
  811. Attribute Font.VB_ProcData.VB_Invoke_Property = ";Font"
  812. Attribute Font.VB_UserMemId = -512
  813.  
  814.     Set Font = UserControl.Font
  815.  
  816. End Property
  817.  
  818. Public Property Set Font(ByRef newFont As Font)
  819.  
  820.     Set UserControl.Font = newFont
  821.     Call CalcTextRects
  822.     Call Redraw(0, True)
  823.     PropertyChanged "FONT"
  824.  
  825. End Property
  826.  
  827. Public Property Get FontBold() As Boolean
  828. Attribute FontBold.VB_MemberFlags = "400"
  829.  
  830.     FontBold = UserControl.FontBold
  831.  
  832. End Property
  833.  
  834. Public Property Let FontBold(ByVal newValue As Boolean)
  835.  
  836.     UserControl.FontBold = newValue
  837.     Call CalcTextRects
  838.     Call Redraw(0, True)
  839.  
  840. End Property
  841.  
  842. Public Property Get FontItalic() As Boolean
  843. Attribute FontItalic.VB_MemberFlags = "400"
  844.  
  845.     FontItalic = UserControl.FontItalic
  846.  
  847. End Property
  848.  
  849. Public Property Let FontItalic(ByVal newValue As Boolean)
  850.  
  851.     UserControl.FontItalic = newValue
  852.     Call CalcTextRects
  853.     Call Redraw(0, True)
  854.  
  855. End Property
  856.  
  857. Public Property Get FontUnderline() As Boolean
  858. Attribute FontUnderline.VB_MemberFlags = "400"
  859.  
  860.     FontUnderline = UserControl.FontUnderline
  861.  
  862. End Property
  863.  
  864. Public Property Let FontUnderline(ByVal newValue As Boolean)
  865.  
  866.     UserControl.FontUnderline = newValue
  867.     Call CalcTextRects
  868.     Call Redraw(0, True)
  869.  
  870. End Property
  871.  
  872. Public Property Get FontSize() As Integer
  873. Attribute FontSize.VB_MemberFlags = "400"
  874.  
  875.     FontSize = UserControl.FontSize
  876.  
  877. End Property
  878.  
  879. Public Property Let FontSize(ByVal newValue As Integer)
  880.  
  881.     UserControl.FontSize = newValue
  882.     Call CalcTextRects
  883.     Call Redraw(0, True)
  884.  
  885. End Property
  886.  
  887. Public Property Get FontName() As String
  888. Attribute FontName.VB_MemberFlags = "400"
  889.  
  890.     FontName = UserControl.FontName
  891.  
  892. End Property
  893.  
  894. Public Property Let FontName(ByVal newValue As String)
  895.  
  896.     UserControl.FontName = newValue
  897.     Call CalcTextRects
  898.     Call Redraw(0, True)
  899.  
  900. End Property
  901.  
  902. 'it is very common that a windows user uses custom color
  903. 'schemes to view his/her desktop, and is also very
  904. 'common that this color scheme has weird colors that
  905. 'would alter the nice look of my buttons.
  906. 'So if you want to force the button to use the windows
  907. 'standard colors you may change this property to "Force Standard"
  908.  
  909. Public Property Get ColorScheme() As ColorTypes
  910. Attribute ColorScheme.VB_ProcData.VB_Invoke_Property = ";Appearance"
  911.  
  912.     ColorScheme = MyColorType
  913.  
  914. End Property
  915.  
  916. Public Property Let ColorScheme(ByVal newValue As ColorTypes)
  917.  
  918.     MyColorType = newValue
  919.     Call SetColors
  920.     Call Redraw(0, True)
  921.     PropertyChanged "COLTYPE"
  922.  
  923. End Property
  924.  
  925. Public Property Get ShowFocusRect() As Boolean
  926. Attribute ShowFocusRect.VB_ProcData.VB_Invoke_Property = ";Appearance"
  927.  
  928.     ShowFocusRect = showFocusR
  929.  
  930. End Property
  931.  
  932. Public Property Let ShowFocusRect(ByVal newValue As Boolean)
  933.  
  934.     showFocusR = newValue
  935.     Call Redraw(lastStat, True)
  936.     PropertyChanged "FOCUSR"
  937.  
  938. End Property
  939.  
  940. Public Property Get MousePointer() As MousePointerConstants
  941. Attribute MousePointer.VB_ProcData.VB_Invoke_Property = ";Appearance"
  942.  
  943.     MousePointer = UserControl.MousePointer
  944.  
  945. End Property
  946.  
  947. Public Property Let MousePointer(ByVal newPointer As MousePointerConstants)
  948.  
  949.     UserControl.MousePointer = newPointer
  950.     PropertyChanged "MPTR"
  951.  
  952. End Property
  953.  
  954. Public Property Get MouseIcon() As StdPicture
  955. Attribute MouseIcon.VB_ProcData.VB_Invoke_Property = ";Appearance"
  956.  
  957.     Set MouseIcon = UserControl.MouseIcon
  958.  
  959. End Property
  960.  
  961. Public Property Set MouseIcon(ByVal newIcon As StdPicture)
  962.  
  963.     On Local Error Resume Next
  964.         Set UserControl.MouseIcon = newIcon
  965.         PropertyChanged "MICON"
  966.     On Error GoTo 0
  967.  
  968. End Property
  969.  
  970. Public Property Get HandPointer() As Boolean
  971.  
  972.     HandPointer = useHand
  973.  
  974. End Property
  975.  
  976. Public Property Let HandPointer(ByVal newVal As Boolean)
  977.  
  978.     useHand = newVal
  979.     If useHand Then
  980.         Set UserControl.MouseIcon = LoadResPicture(101, 2)
  981.         UserControl.MousePointer = 99
  982.     Else
  983.         Set UserControl.MouseIcon = Nothing
  984.         UserControl.MousePointer = 1
  985.     End If
  986.     PropertyChanged "HAND"
  987.  
  988. End Property
  989.  
  990. Public Property Get hwnd() As Long
  991. Attribute hwnd.VB_UserMemId = -515
  992.  
  993.     hwnd = UserControl.hwnd
  994.  
  995. End Property
  996.  
  997. Public Property Get SoftBevel() As Boolean
  998. Attribute SoftBevel.VB_ProcData.VB_Invoke_Property = ";Appearance"
  999.  
  1000.     SoftBevel = isSoft
  1001.  
  1002. End Property
  1003.  
  1004. Public Property Let SoftBevel(ByVal newValue As Boolean)
  1005.  
  1006.     isSoft = newValue
  1007.     Call SetColors
  1008.     Call Redraw(lastStat, True)
  1009.     PropertyChanged "SOFT"
  1010.  
  1011. End Property
  1012.  
  1013. Public Property Get PictureNormal() As StdPicture
  1014. Attribute PictureNormal.VB_ProcData.VB_Invoke_Property = ";Appearance"
  1015.  
  1016.     Set PictureNormal = picNormal
  1017.  
  1018. End Property
  1019.  
  1020. Public Property Set PictureNormal(ByVal newPic As StdPicture)
  1021.  
  1022.     Set picNormal = newPic
  1023.     Call CalcPicSize
  1024.     Call CalcTextRects
  1025.     Call Redraw(lastStat, True)
  1026.     PropertyChanged "PICN"
  1027.  
  1028. End Property
  1029.  
  1030. Public Property Get PictureOver() As StdPicture
  1031. Attribute PictureOver.VB_ProcData.VB_Invoke_Property = ";Appearance"
  1032.  
  1033.     Set PictureOver = picHover
  1034.  
  1035. End Property
  1036.  
  1037. Public Property Set PictureOver(ByVal newPic As StdPicture)
  1038.  
  1039.     Set picHover = newPic
  1040.     If isOver Then Call Redraw(lastStat, True) 'only redraw i we need to see this picture immediately
  1041.     PropertyChanged "PICO"
  1042.  
  1043. End Property
  1044.  
  1045. Public Property Get PicturePosition() As PicPositions
  1046. Attribute PicturePosition.VB_ProcData.VB_Invoke_Property = ";Position"
  1047.  
  1048.     PicturePosition = PicPosition
  1049.  
  1050. End Property
  1051.  
  1052. Public Property Let PicturePosition(ByVal newPicPos As PicPositions)
  1053.  
  1054.     PicPosition = newPicPos
  1055.     PropertyChanged "PICPOS"
  1056.     Call CalcTextRects
  1057.     Call Redraw(lastStat, True)
  1058.  
  1059. End Property
  1060.  
  1061. Public Property Get UseMaskColor() As Boolean
  1062. Attribute UseMaskColor.VB_ProcData.VB_Invoke_Property = ";Appearance"
  1063.  
  1064.     UseMaskColor = useMask
  1065.  
  1066. End Property
  1067.  
  1068. Public Property Let UseMaskColor(ByVal newValue As Boolean)
  1069.  
  1070.     useMask = newValue
  1071.     If Not picNormal Is Nothing Then Call Redraw(lastStat, True)
  1072.     PropertyChanged "UMCOL"
  1073.  
  1074. End Property
  1075.  
  1076. Public Property Get UseGreyscale() As Boolean
  1077. Attribute UseGreyscale.VB_ProcData.VB_Invoke_Property = ";Appearance"
  1078.  
  1079.     UseGreyscale = useGrey
  1080.  
  1081. End Property
  1082.  
  1083. Public Property Let UseGreyscale(ByVal newValue As Boolean)
  1084.  
  1085.     useGrey = newValue
  1086.     If Not picNormal Is Nothing Then Call Redraw(lastStat, True)
  1087.     PropertyChanged "NGREY"
  1088.  
  1089. End Property
  1090.  
  1091. Public Property Get SpecialEffect() As fx
  1092. Attribute SpecialEffect.VB_ProcData.VB_Invoke_Property = ";Appearance"
  1093.  
  1094.     SpecialEffect = SFX
  1095.  
  1096. End Property
  1097.  
  1098. Public Property Let SpecialEffect(ByVal newValue As fx)
  1099.  
  1100.     SFX = newValue
  1101.     Call Redraw(lastStat, True)
  1102.     PropertyChanged "FX"
  1103.  
  1104. End Property
  1105.  
  1106. Public Property Get CheckBoxBehaviour() As Boolean
  1107.  
  1108.     CheckBoxBehaviour = isCheckbox
  1109.  
  1110. End Property
  1111.  
  1112. Public Property Let CheckBoxBehaviour(ByVal newValue As Boolean)
  1113.  
  1114.     isCheckbox = newValue
  1115.     Call Redraw(lastStat, True)
  1116.     PropertyChanged "CHECK"
  1117.  
  1118. End Property
  1119.  
  1120. Public Property Get Value() As Boolean
  1121.  
  1122.     Value = cValue
  1123.  
  1124. End Property
  1125.  
  1126. Public Property Let Value(ByVal newValue As Boolean)
  1127.  
  1128.     cValue = newValue
  1129.     If isCheckbox Then Call Redraw(0, True)
  1130.     PropertyChanged "VALUE"
  1131.  
  1132. End Property
  1133.  
  1134. Public Property Get Version() As String
  1135. Attribute Version.VB_MemberFlags = "40"
  1136.  
  1137.     Version = cbVersion
  1138.  
  1139. End Property
  1140.  
  1141. '########## END OF PROPERTIES ##########
  1142.  
  1143. Private Sub UserControl_Resize()
  1144.  
  1145.     If inLoop Then Exit Sub
  1146.     'get button size
  1147.     GetClientRect UserControl.hwnd, rc3
  1148.     'assign these values to He and Wi
  1149.     He = rc3.Bottom: Wi = rc3.Right
  1150.     'build the FocusRect size and position depending on the button type
  1151.     If MyButtonType >= [Simple Flat] And MyButtonType <= [Oval Flat] Then
  1152.         InflateRect rc3, -3, -3
  1153.     ElseIf MyButtonType = [KDE 2] Then
  1154.         InflateRect rc3, -5, -5
  1155.         OffsetRect rc3, 1, 1
  1156.     Else
  1157.         InflateRect rc3, -4, -4
  1158.     End If
  1159.     Call CalcTextRects
  1160.  
  1161.     If rgnNorm Then DeleteObject rgnNorm
  1162.     Call MakeRegion
  1163.     SetWindowRgn UserControl.hwnd, rgnNorm, True
  1164.  
  1165.     If He Then Call Redraw(0, True)
  1166.  
  1167. End Sub
  1168.  
  1169. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  1170.  
  1171.     With PropBag
  1172.         MyButtonType = .ReadProperty("BTYPE", 2)
  1173.         elTex = .ReadProperty("TX", "")
  1174.         isEnabled = .ReadProperty("ENAB", True)
  1175.         Set UserControl.Font = .ReadProperty("FONT", UserControl.Font)
  1176.         MyColorType = .ReadProperty("COLTYPE", 1)
  1177.         showFocusR = .ReadProperty("FOCUSR", True)
  1178.         BackC = .ReadProperty("BCOL", GetSysColor(COLOR_BTNFACE))
  1179.         BackO = .ReadProperty("BCOLO", BackC)
  1180.         ForeC = .ReadProperty("FCOL", GetSysColor(COLOR_BTNTEXT))
  1181.         ForeO = .ReadProperty("FCOLO", ForeC)
  1182.         MaskC = .ReadProperty("MCOL", &HC0C0C0)
  1183.         UserControl.MousePointer = .ReadProperty("MPTR", 0)
  1184.         Set UserControl.MouseIcon = .ReadProperty("MICON", Nothing)
  1185.         Set picNormal = .ReadProperty("PICN", Nothing)
  1186.         Set picHover = .ReadProperty("PICH", Nothing)
  1187.         useMask = .ReadProperty("UMCOL", True)
  1188.         isSoft = .ReadProperty("SOFT", False)
  1189.         PicPosition = .ReadProperty("PICPOS", 0)
  1190.         useGrey = .ReadProperty("NGREY", False)
  1191.         SFX = .ReadProperty("FX", 0)
  1192.         Me.HandPointer = .ReadProperty("HAND", False)
  1193.         isCheckbox = .ReadProperty("CHECK", False)
  1194.         cValue = .ReadProperty("VALUE", False)
  1195.     End With
  1196.  
  1197.     UserControl.Enabled = isEnabled
  1198.     Call CalcPicSize
  1199.     Call CalcTextRects
  1200.     Call SetAccessKeys
  1201.  
  1202. End Sub
  1203.  
  1204. Private Sub UserControl_Show()
  1205.  
  1206.     If MyButtonType = 11 Then
  1207.         If pDC = 0 Then
  1208.             pDC = CreateCompatibleDC(UserControl.hdc): pBM = CreateBitmap(Wi, He, 1, GetDeviceCaps(hdc, 12), ByVal 0&)
  1209.             oBM = SelectObject(pDC, pBM)
  1210.         End If
  1211.  
  1212.         Call GetParentPic
  1213.     End If
  1214.  
  1215.     isShown = True
  1216.     Call SetColors
  1217.     Call Redraw(0, True)
  1218.  
  1219. End Sub
  1220.  
  1221. Private Sub UserControl_Terminate()
  1222.  
  1223.     isShown = False
  1224.     DeleteObject rgnNorm
  1225.     If pDC Then
  1226.         DeleteObject SelectObject(pDC, oBM)
  1227.         DeleteDC pDC
  1228.     End If
  1229.  
  1230. End Sub
  1231.  
  1232. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  1233.  
  1234.     With PropBag
  1235.         Call .WriteProperty("BTYPE", MyButtonType)
  1236.         Call .WriteProperty("TX", elTex)
  1237.         Call .WriteProperty("ENAB", isEnabled)
  1238.         Call .WriteProperty("FONT", UserControl.Font)
  1239.         Call .WriteProperty("COLTYPE", MyColorType)
  1240.         Call .WriteProperty("FOCUSR", showFocusR)
  1241.         Call .WriteProperty("BCOL", BackC)
  1242.         Call .WriteProperty("BCOLO", BackO)
  1243.         Call .WriteProperty("FCOL", ForeC)
  1244.         Call .WriteProperty("FCOLO", ForeO)
  1245.         Call .WriteProperty("MCOL", MaskC)
  1246.         Call .WriteProperty("MPTR", UserControl.MousePointer)
  1247.         Call .WriteProperty("MICON", UserControl.MouseIcon)
  1248.         Call .WriteProperty("PICN", picNormal)
  1249.         Call .WriteProperty("PICH", picHover)
  1250.         Call .WriteProperty("UMCOL", useMask)
  1251.         Call .WriteProperty("SOFT", isSoft)
  1252.         Call .WriteProperty("PICPOS", PicPosition)
  1253.         Call .WriteProperty("NGREY", useGrey)
  1254.         Call .WriteProperty("FX", SFX)
  1255.         Call .WriteProperty("HAND", useHand)
  1256.         Call .WriteProperty("CHECK", isCheckbox)
  1257.         Call .WriteProperty("VALUE", cValue)
  1258.     End With
  1259.  
  1260. End Sub
  1261.  
  1262. Private Sub Redraw(ByVal curStat As Byte, ByVal Force As Boolean)
  1263.  
  1264. 'here is the CORE of the button, everything is drawn here
  1265. 'it's not well commented but i think that everything is
  1266. 'pretty self explanatory...
  1267.  
  1268.     If isCheckbox And cValue Then curStat = 2
  1269.  
  1270.     If Not Force Then  'check drawing redundancy
  1271.         If (curStat = lastStat) And (TE = elTex) Then Exit Sub
  1272.     End If
  1273.  
  1274.     If He = 0 Or Not isShown Then Exit Sub   'we don't want errors
  1275.  
  1276.     lastStat = curStat
  1277.     TE = elTex
  1278.  
  1279. Dim i As Long, stepXP1 As Single, XPFace2 As Long, tempCol As Long
  1280.  
  1281.     With UserControl
  1282.         .Cls
  1283.         If isOver And MyColorType = Custom Then tempCol = BackC: BackC = BackO: SetColors
  1284.  
  1285.         DrawRectangle 0, 0, Wi, He, cFace
  1286.  
  1287.         If isEnabled Then
  1288.             If curStat = 0 Then
  1289.                 '#@#@#@#@#@# BUTTON NORMAL STATE #@#@#@#@#@#
  1290.                 Select Case MyButtonType
  1291.                 Case 1 'Windows 16-bit
  1292.                     Call DrawCaption(Abs(isOver))
  1293.                     DrawFrame cHighLight, cShadow, cHighLight, cShadow, True
  1294.                     DrawRectangle 0, 0, Wi, He, cDarkShadow, True
  1295.                     Call DrawFocusR
  1296.                 Case 2 'Windows 32-bit
  1297.                     Call DrawCaption(Abs(isOver))
  1298.                     If Ambient.DisplayAsDefault And showFocusR Then
  1299.                         DrawFrame cHighLight, cDarkShadow, cLight, cShadow, True
  1300.                         Call DrawFocusR
  1301.                         DrawRectangle 0, 0, Wi, He, cDarkShadow, True
  1302.                     Else
  1303.                         DrawFrame cHighLight, cDarkShadow, cLight, cShadow, False
  1304.                     End If
  1305.                 Case 3 'Windows XP
  1306.                     stepXP1 = 25 / He
  1307.                     For i = 1 To He
  1308.                         DrawLine 0, i, Wi, i, ShiftColor(XPFace, -stepXP1 * i, True)
  1309.                     Next i
  1310.                     Call DrawCaption(Abs(isOver))
  1311.                     DrawRectangle 0, 0, Wi, He, &H733C00, True
  1312.                     mSetPixel 1, 1, &H7B4D10
  1313.                     mSetPixel 1, He - 2, &H7B4D10
  1314.                     mSetPixel Wi - 2, 1, &H7B4D10
  1315.                     mSetPixel Wi - 2, He - 2, &H7B4D10
  1316.  
  1317.                     If isOver Then
  1318.                         DrawRectangle 1, 2, Wi - 2, He - 4, &H31B2FF, True
  1319.                         DrawLine 2, He - 2, Wi - 2, He - 2, &H96E7&
  1320.                         DrawLine 2, 1, Wi - 2, 1, &HCEF3FF
  1321.                         DrawLine 1, 2, Wi - 1, 2, &H8CDBFF
  1322.                         DrawLine 2, 3, 2, He - 3, &H6BCBFF
  1323.                         DrawLine Wi - 3, 3, Wi - 3, He - 3, &H6BCBFF
  1324.                     ElseIf ((HasFocus Or Ambient.DisplayAsDefault) And showFocusR) Then
  1325.                         DrawRectangle 1, 2, Wi - 2, He - 4, &HE7AE8C, True
  1326.                         DrawLine 2, He - 2, Wi - 2, He - 2, &HEF826B
  1327.                         DrawLine 2, 1, Wi - 2, 1, &HFFE7CE
  1328.                         DrawLine 1, 2, Wi - 1, 2, &HF7D7BD
  1329.                         DrawLine 2, 3, 2, He - 3, &HF0D1B5
  1330.                         DrawLine Wi - 3, 3, Wi - 3, He - 3, &HF0D1B5
  1331.                     Else 'we do not draw the bevel always because the above code would repaint over it
  1332.                         DrawLine 2, He - 2, Wi - 2, He - 2, ShiftColor(XPFace, -&H30, True)
  1333.                         DrawLine 1, He - 3, Wi - 2, He - 3, ShiftColor(XPFace, -&H20, True)
  1334.                         DrawLine Wi - 2, 2, Wi - 2, He - 2, ShiftColor(XPFace, -&H24, True)
  1335.                         DrawLine Wi - 3, 3, Wi - 3, He - 3, ShiftColor(XPFace, -&H18, True)
  1336.                         DrawLine 2, 1, Wi - 2, 1, ShiftColor(XPFace, &H10, True)
  1337.                         DrawLine 1, 2, Wi - 2, 2, ShiftColor(XPFace, &HA, True)
  1338.                         DrawLine 1, 2, 1, He - 2, ShiftColor(XPFace, -&H5, True)
  1339.                         DrawLine 2, 3, 2, He - 3, ShiftColor(XPFace, -&HA, True)
  1340.                     End If
  1341.                 Case 4 'Mac
  1342.                     DrawRectangle 1, 1, Wi - 2, He - 2, cLight
  1343.                     Call DrawCaption(Abs(isOver))
  1344.                     DrawRectangle 0, 0, Wi, He, cDarkShadow, True
  1345.                     mSetPixel 1, 1, cDarkShadow
  1346.                     mSetPixel 1, He - 2, cDarkShadow
  1347.                     mSetPixel Wi - 2, 1, cDarkShadow
  1348.                     mSetPixel Wi - 2, He - 2, cDarkShadow
  1349.                     DrawLine 1, 2, 2, 0, cFace
  1350.                     DrawLine 3, 2, Wi - 3, 2, cHighLight
  1351.                     DrawLine 2, 2, 2, He - 3, cHighLight
  1352.                     mSetPixel 3, 3, cHighLight
  1353.                     DrawLine Wi - 3, 1, Wi - 3, He - 3, cFace
  1354.                     DrawLine 1, He - 3, Wi - 3, He - 3, cFace
  1355.                     mSetPixel Wi - 4, He - 4, cFace
  1356.                     DrawLine Wi - 2, 2, Wi - 2, He - 2, cShadow
  1357.                     DrawLine 2, He - 2, Wi - 2, He - 2, cShadow
  1358.                     mSetPixel Wi - 3, He - 3, cShadow
  1359.                 Case 5 'Java
  1360.                     DrawRectangle 1, 1, Wi - 1, He - 1, ShiftColor(cFace, &HC)
  1361.                     Call DrawCaption(Abs(isOver))
  1362.                     DrawRectangle 1, 1, Wi - 1, He - 1, cHighLight, True
  1363.                     DrawRectangle 0, 0, Wi - 1, He - 1, ShiftColor(cShadow, -&H1A), True
  1364.                     mSetPixel 1, He - 2, ShiftColor(cShadow, &H1A)
  1365.                     mSetPixel Wi - 2, 1, ShiftColor(cShadow, &H1A)
  1366.                     If HasFocus And showFocusR Then DrawRectangle rc.Left - 2, rc.Top - 1, fc.X + 4, fc.Y + 2, &HCC9999, True
  1367.                 Case 6 'Netscape
  1368.                     Call DrawCaption(Abs(isOver))
  1369.                     DrawFrame ShiftColor(cLight, &H8), cShadow, ShiftColor(cLight, &H8), cShadow, False
  1370.                     Call DrawFocusR
  1371.                 Case 7, 8, 12 'Flat buttons
  1372.                     Call DrawCaption(Abs(isOver))
  1373.                     If (MyButtonType = [Simple Flat]) Then
  1374.                         DrawFrame cHighLight, cShadow, 0, 0, False, True
  1375.                     ElseIf isOver Then
  1376.                         If MyButtonType = [Flat Highlight] Then
  1377.                             DrawFrame cHighLight, cShadow, 0, 0, False, True
  1378.                         Else
  1379.                             DrawFrame cHighLight, cDarkShadow, cLight, cShadow, False, False
  1380.                         End If
  1381.                     End If
  1382.                     Call DrawFocusR
  1383.                 Case 9 'Office XP
  1384.                     If isOver Then DrawRectangle 1, 1, Wi, He, OXPf
  1385.                     Call DrawCaption(Abs(isOver))
  1386.                     If isOver Then DrawRectangle 0, 0, Wi, He, OXPb, True
  1387.                     Call DrawFocusR
  1388.                 Case 11 'transparent
  1389.                     BitBlt hdc, 0, 0, Wi, He, pDC, 0, 0, vbSrcCopy
  1390.                     Call DrawCaption(Abs(isOver))
  1391.                     Call DrawFocusR
  1392.                 Case 13 'Oval
  1393.                     DrawEllipse 0, 0, Wi, He, Abs(isOver) * cShadow + Abs(Not isOver) * cFace, cFace
  1394.                     Call DrawCaption(Abs(isOver))
  1395.                 Case 14 'KDE 2
  1396.                     Dim prevBold As Boolean
  1397.                     If Not isOver Then
  1398.                         stepXP1 = 58 / He
  1399.                         For i = 1 To He
  1400.                             DrawLine 0, i, Wi, i, ShiftColor(cHighLight, -stepXP1 * i)
  1401.                         Next i
  1402.                     Else
  1403.                         DrawRectangle 0, 0, Wi, He, cLight
  1404.                     End If
  1405.                     If Ambient.DisplayAsDefault Then isShown = False: prevBold = Me.FontBold: Me.FontBold = True
  1406.                     Call DrawCaption(Abs(isOver))
  1407.                     If Ambient.DisplayAsDefault Then Me.FontBold = prevBold: isShown = True
  1408.                     DrawRectangle 0, 0, Wi, He, ShiftColor(cShadow, -&H32), True
  1409.                     DrawRectangle 1, 1, Wi - 2, He - 2, ShiftColor(cFace, -&H9), True
  1410.                     DrawRectangle 2, 2, Wi - 4, 2, cHighLight
  1411.                     DrawRectangle 2, 4, 2, He - 6, cHighLight
  1412.                     Call DrawFocusR
  1413.                 End Select
  1414.                 Call DrawPictures(0)
  1415.             ElseIf curStat = 2 Then
  1416.                 '#@#@#@#@#@# BUTTON IS DOWN #@#@#@#@#@#
  1417.                 Select Case MyButtonType
  1418.                 Case 1 'Windows 16-bit
  1419.                     Call DrawCaption(2)
  1420.                     DrawFrame cShadow, cHighLight, cShadow, cHighLight, True
  1421.                     DrawRectangle 0, 0, Wi, He, cDarkShadow, True
  1422.                     Call DrawFocusR
  1423.                 Case 2 'Windows 32-bit
  1424.                     Call DrawCaption(2)
  1425.                     If showFocusR And Ambient.DisplayAsDefault Then
  1426.                         DrawRectangle 0, 0, Wi, He, cDarkShadow, True
  1427.                         DrawRectangle 1, 1, Wi - 2, He - 2, cShadow, True
  1428.                         Call DrawFocusR
  1429.                     Else
  1430.                         DrawFrame cDarkShadow, cHighLight, cShadow, cLight, False
  1431.                     End If
  1432.                 Case 3 'Windows XP
  1433.                     stepXP1 = 25 / He
  1434.                     XPFace2 = ShiftColor(XPFace, -32, True)
  1435.                     For i = 1 To He
  1436.                         DrawLine 0, He - i, Wi, He - i, ShiftColor(XPFace2, -stepXP1 * i, True)
  1437.                     Next i
  1438.                     Call DrawCaption(2)
  1439.                     DrawRectangle 0, 0, Wi, He, &H733C00, True
  1440.                     mSetPixel 1, 1, &H7B4D10
  1441.                     mSetPixel 1, He - 2, &H7B4D10
  1442.                     mSetPixel Wi - 2, 1, &H7B4D10
  1443.                     mSetPixel Wi - 2, He - 2, &H7B4D10
  1444.  
  1445.                     DrawLine 2, He - 2, Wi - 2, He - 2, ShiftColor(XPFace2, &H10, True)
  1446.                     DrawLine 1, He - 3, Wi - 2, He - 3, ShiftColor(XPFace2, &HA, True)
  1447.                     DrawLine Wi - 2, 2, Wi - 2, He - 2, ShiftColor(XPFace2, &H5, True)
  1448.                     DrawLine Wi - 3, 3, Wi - 3, He - 3, XPFace
  1449.                     DrawLine 2, 1, Wi - 2, 1, ShiftColor(XPFace2, -&H20, True)
  1450.                     DrawLine 1, 2, Wi - 2, 2, ShiftColor(XPFace2, -&H18, True)
  1451.                     DrawLine 1, 2, 1, He - 2, ShiftColor(XPFace2, -&H20, True)
  1452.                     DrawLine 2, 2, 2, He - 2, ShiftColor(XPFace2, -&H16, True)
  1453.                 Case 4 'Mac
  1454.                     DrawRectangle 1, 1, Wi - 2, He - 2, ShiftColor(cShadow, -&H10)
  1455.                     XPFace = ShiftColor(cShadow, -&H10)
  1456.                     Call DrawCaption(2)
  1457.                     XPFace = ShiftColor(cFace, &H30)
  1458.                     DrawRectangle 0, 0, Wi, He, cDarkShadow, True
  1459.                     DrawRectangle 1, 1, Wi - 2, He - 2, ShiftColor(cShadow, -&H40), True
  1460.                     DrawRectangle 2, 2, Wi - 4, He - 4, ShiftColor(cShadow, -&H20), True
  1461.                     mSetPixel 2, 2, ShiftColor(cShadow, -&H40)
  1462.                     mSetPixel 3, 3, ShiftColor(cShadow, -&H20)
  1463.                     mSetPixel 1, 1, cDarkShadow
  1464.                     mSetPixel 1, He - 2, cDarkShadow
  1465.                     mSetPixel Wi - 2, 1, cDarkShadow
  1466.                     mSetPixel Wi - 2, He - 2, cDarkShadow
  1467.                     DrawLine Wi - 3, 1, Wi - 3, He - 3, cShadow
  1468.                     DrawLine 1, He - 3, Wi - 2, He - 3, cShadow
  1469.                     mSetPixel Wi - 4, He - 4, cShadow
  1470.                     DrawLine Wi - 2, 3, Wi - 2, He - 2, ShiftColor(cShadow, -&H10)
  1471.                     DrawLine 3, He - 2, Wi - 2, He - 2, ShiftColor(cShadow, -&H10)
  1472.                     DrawLine Wi - 2, He - 3, Wi - 4, He - 1, ShiftColor(cShadow, -&H20)
  1473.                     mSetPixel 2, He - 2, ShiftColor(cShadow, -&H20)
  1474.                     mSetPixel Wi - 2, 2, ShiftColor(cShadow, -&H20)
  1475.                 Case 5 'Java
  1476.                     DrawRectangle 1, 1, Wi - 2, He - 2, ShiftColor(cShadow, &H10), False
  1477.                     DrawRectangle 0, 0, Wi - 1, He - 1, ShiftColor(cShadow, -&H1A), True
  1478.                     DrawLine Wi - 1, 1, Wi - 1, He, cHighLight
  1479.                     DrawLine 1, He - 1, Wi - 1, He - 1, cHighLight
  1480.                     SetTextColor .hdc, cTextO
  1481.                     Draw    = 25        hLigh'He - 2, Shif          n1, cHighLight
  1482.                     SetTextColor .hdc, cTextO
  1483.                     SetTextColorc   'fore  b    He - 3, Wi - 4, He - 1, ShiftColor(cShadraw  l_K He - 1, Sd                        DrawLine 1, H1, Sd      i - 2     -lR           SetTextrrrrrws
  1484. 'lori, Wi I    DrawLine 1, H1, Sd      i - 2     -lR                 eoetPixel Wi - 2, He - 2, &H7B4D10    He
  1485.                     XPlags, i - 2     -lR s, cHighLight Sd      i - 2     -lR          0, W1, H1, Sd      i - 2, i - C.X'        CalSd      i - 2, He - 2, &H7B4De1, Shif Ca          Draw   (XPFace2, hdc, cTextO
  1486.        Caingle)
  1487.  
  1488.     RaiseEvent MouseDown(B
  1489.  
  1490.     RaiseEvent MouseDown(B
  1491.  
  1492.     Raise
  1493.  
  1494.     Rail Wi - 2, He
  1495.     xtO
  1496.             Caingle)
  1497. extCol1d    
  1498.  
  1499.        XPFace = Shle)
  1500. e10)   0, W1, H1, Sd      i - 2,      txPnd Iall DrawCaptiod      i  xtO
  1501.             XPFace = Shle)(       10            oHe - 2, cLight
  1502. bine e xtn Ca      XPFace = Shle)(cLigCa    - 3
  1503.        
  1504.  
  1505.     RaiseEvent Mou- 1, Wi -        ntBold   nt)
  1506.              DrawRectangle 1, 1, Wi - 2ExPnd I        ice XPe    Caia, Shle)(cLigCngle 1,e, He
  1507.     x    cusRthat theud Wi - 2ExPnd        ice XPe    Caia, , Wi - 1, Hegle 1ointer As MousePointerConstaaia
  1508.    rgn  x  =====e 1,e, H     XPe    Caia, , Wi - 1, Hegled        iceP() As OLE_COLOR
  1509. Attri)x  == - 3, Wi - 4, Htion(2)
  1510.    9 'OceP() As)x  == - 3, Wi -=gCn                  DrawLine Wi - 3    DraP, 3, Wi - 3 Wi        End If Wi - 2ExPnooooooolor(XPFace2, &HA, True)
  1511.             a         
  1512.                     Call DrawCaption(2P   .       ) As)x RInvoke_Property = ";AppesRtf Wi - 2ExPPPPPPPPRIn       (xel 2,rawLine 1, H
  1513.    o 2,r"&H20, True)Wi - 2, He - 2ou-e 2 'Windows 32perty,r"&H20, True)Wi - 2, He - 2ou-e 2 'l     a         
  1514.             e      DrawReawLaise
  1515.  
  1516.     Ral     a  ter(ByVal newPointer Asd  DrawReawLaise
  1517. RaiseEvent MouseDown(B
  1518.  
  1519.  .P mSeee  
  1520.     Asd  DcIh1=d                Case 5 'JPFace2, &HA,2, ShiftColor0)
  1521.                     DrawLight Sd    _Prope2h1=d    h1=d                        Call        -lR                 eoetPixawLaisell     "ShoweDraP, 3, (Wi - 2, 1, &HHe
  1522.                     XPFace2 =       e=2      eC  e=2    wLaise
  1523. True
  1524.       inter Asd  DrawReawLaise
  1525. RaiseEveCain   XPFace    e=2      gs,Property, True)Wi - 2,ore l-stepXP1ll DrawCa1, Wi - serCfncdurue
  1526.           mSetPixel Wi - 2, 1, &H7B4D10
  1527.                     mSetPixel Wi - 2, He - 2, &H7B4D10
  1528.  
  1529.          SetR          0, W1, H1,Line Wi - 3,
  1530.   OLOe
  1531. Raise ice         Set       e=dicSet
  1532. End Sub
  1533.  .P mSeee   w
  1534.  re outs Wi a"gB( -lR      2,                    Call DrawCaptionrCfncdurui - 3, He - 3, cFace
  1535.    PertyChanged "PICO"
  1536.  
  1537. "PICO"
  1538.  
  1539. "PICO"
  1540.  
  1541. "PICO"
  1542.  
  1543. "PICO"
  1544. c(eet, He -,He - 3, cFace
  1545.    PertyC- 3, cFace
  1546.    PertyC- 3, cFace
  1547.    PertyC- 3Raise ice         Set       e=dicSetG       sRthhhhhhhhhhhhhbdProperty("H1
  1548.  
  1549.   SetR      e -,He -d    
  1550.  
  1551.        XPFace = Shle)
  1552. e10)   ptionrCfncdurui - 3, He - 3, cFace
  1553.    PertyChanged "PICO"
  1554.  
  1555. "PICO"
  1556.  
  1557. "PICO"
  1558.  
  1559. "PICO"
  1560.  
  1561. "PICO"
  1562. c(eet
  1563.  
  1564. EndyC- 3, cFace
  1565.    PSetPixelcLigdSlRaise,Heaise ice  , cacexelcLi", GetSysCollcLigdSlRais, He - Cmty("H1
  1566.  
  1567.   SetR      e -,He -d    
  1568.  
  1569.  ftCol cacexelcLi", GetSysC   ,cusFace
  1570.    PertyChanged "PICO"
  1571.  
  1572. 8=     d    
  1573. '    
  1574.    PertyC- 3, End If
  1575.        ue
  1576.  Aol cacele) 1, Wi - 2, 1, Shi     Mou   If (curStay2, He - 2,ol cacele)i,e"
  1577.  
  1578.     U("
  1579. Rectap2,ol ca  Call      "Ee = Shle)r(cShadowcl, Wi - 2, 2, ShiftColCi - 2, H  XPFaYhiftColor(cShadow, -&H40)
  1580.       l   PertyChserCsw, Trusd  DcIh1=d                C<Ase, uShadow
  1581.       3, cFa&eIProperty("FO)W     1, Hegle 1ointerrrrrrw He -  Mou   Iet*,,,,,,,,,,,,,,,,'Ase, uSh, He   Iet*,,,*,,et*,,, uShadowF Ra5, True) -=gCn         ntBold   nt)
  1582.      uaventerty("FO'    Se,,,,,,,,
  1583. "PIC, cacexelcLi", GetSysCollcLigdS(gle ,, uShadowF R,,,*,,et*,,, uShadowF Ra5, True) -=gCn     DrawL      Cae oHe - 2, ";Position"F Ra5, Tru Ext0=dow   uah"
  1584.  
  1585. "PI&HCC9999, Tru4ub   rtyChanged cacexelcLi",  i 3, Wi("FO'    S  rtyChanged cacexelcLi",  i 3, Wi("FO' Changed cacexelcLi",  i 3, Wi("FO' Cha   d  0=dce
  1586.    PertyChangeT1           Call DrawCaption(Abs(isOver))
  1587.                     If (MyButtonType = [SiF,, uShado- 4,     ii",  i 3, Wi("FO' Changed ce1,e, He
  1588.     x    cusRthat theud Wi          mSetPixel Wi - 2, 2d  DrawReawLaise
  1589.           DrawFrame Swroperty
  1590. Ecertyi -=gCn   nt)f N=w, -&H1A), True
  1591.                     DrawShii", GetSysC   ,cusFa3GO' Chans.