Advertisement
seaeagle23

Hex User Control

Aug 3rd, 2014
1,212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.59 KB | None | 0 0
  1. '---------------------------------------------------------------------------------------
  2. ' Module    : bsPolygonButton (User Control)
  3. ' DateTime  : 08/11/2003
  4. ' Author    : Drew (aka The Bad One)
  5. ' Purpose   : To provide a button control that takes the shape of a polygon
  6. '             of almost any number of sides.
  7. '           This is NOT my work...I am providing this for use of a polygon control.
  8. '---------------------------------------------------------------------------------------
  9.  
  10. Option Explicit
  11.  
  12. Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  13. Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As Any, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
  14. Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
  15. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  16. Private Declare Function FillRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
  17. Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, lpPoint As POINTAPI) As Long
  18. Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
  19. Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
  20. 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
  21. Private Declare Function OffsetRect Lib "user32" (lpRect As RECT, ByVal X As Long, ByVal Y As Long) As Long
  22. Private Declare Function DrawFocusRect Lib "user32" (ByVal hdc As Long, lpRect As RECT) As Long
  23. Private Declare Function TranslateColor Lib "olepro32.dll" Alias "OleTranslateColor" (ByVal clr As OLE_COLOR, ByVal palet As Long, col As Long) As Long
  24.  
  25. Private Type RECT
  26.    Left As Long
  27.    Top As Long
  28.    Right As Long
  29.    Bottom As Long
  30. End Type
  31.  
  32. Private Type COORD
  33.    X As Long
  34.    Y As Long
  35. End Type
  36.  
  37. Private Type POINTAPI
  38.    X As Long
  39.    Y As Long
  40. End Type
  41.  
  42. Private Const WINDING = 2
  43. Private Const DT_CALCRECT = &H400
  44. Private Const DT_CENTER = &H1
  45. Private Const DT_NOCLIP = &H100
  46. Private Const DT_VCENTER = &H4
  47.  
  48. Private m_iSides As Integer
  49.  
  50. Const m_def_iSides = 6
  51. 'Default Property Values:
  52. Const m_def_ShowFocus = True
  53. Const m_def_CaptionColour = vbButtonText
  54. Const m_def_ButtonColour = &HBD3FF
  55. Const m_def_LightestColour = &H86FFFF
  56. Const m_def_LightColour = &H57D6FF
  57. Const m_def_DarkColour = &H99CC&
  58. Const m_def_DarkestColour = &H769D&
  59. Const m_def_iRotation = 90
  60.  
  61. 'Property Variables:
  62. Dim m_ShowFocus As Boolean
  63. Dim m_CaptionColour As OLE_COLOR
  64. Dim m_ButtonColour As OLE_COLOR
  65. Dim m_Fount As Font
  66. Dim m_LightestColour As OLE_COLOR
  67. Dim m_LightColour As OLE_COLOR
  68. Dim m_DarkColour As OLE_COLOR
  69. Dim m_DarkestColour As OLE_COLOR
  70. Dim m_Caption As String
  71. Dim m_iRotation As Integer
  72.  
  73. 'Event Declarations:
  74. Event KeyUp(KeyCode As Integer, Shift As Integer)
  75. Event KeyPress(KeyAscii As Integer)
  76. Event KeyDown(KeyCode As Integer, Shift As Integer)
  77. Event Click()
  78. Event DblClick()
  79.  
  80. Const Pi# = 3.1415927
  81. Const CLR_INVALID = &HFFFF
  82.  
  83. Dim hRegion As Long
  84. Dim booGotFocus As Boolean
  85.  
  86.  
  87. '---------------------------------------------------------------------------------------
  88. ' Procedure : bsPolygonButton.Sides
  89. ' DateTime  : 08/11/2003
  90. ' Author    : Drew (aka The Bad One)
  91. ' Purpose   : Gets/sets the number of sides the button has.
  92. ' Assuming  : Number of sides is between 3 and 100, inclusive.
  93. '---------------------------------------------------------------------------------------
  94. '
  95. Public Property Get Sides() As Integer
  96.   Sides = m_iSides
  97. End Property
  98.  
  99. Public Property Let Sides(ByVal iSides As Integer)
  100.   If m_iSides < 3 Then
  101.      m_iSides = 3
  102.   ElseIf m_iSides > 100 Then
  103.      m_iSides = 100
  104.   End If
  105.   m_iSides = iSides
  106.   Call UserControl.PropertyChanged("Sides")
  107.   DrawControl
  108. End Property
  109.  
  110. '---------------------------------------------------------------------------------------
  111. ' Procedure : bsPolygonButton.DrawControl
  112. ' DateTime  : 09/11/2003
  113. ' Author    : Drew (aka The Bad One)
  114. ' Purpose   : Draws the whole control (pressed if necessary).
  115. ' Assuming  : nothing
  116. '---------------------------------------------------------------------------------------
  117. '
  118. Private Sub DrawControl(Optional booPressed As Boolean)
  119.   Dim X(0 To 1) As Single, Y(0 To 1) As Single
  120.   Dim rctControl As RECT, lpOld As POINTAPI
  121.   Dim I As Integer, iCounter As Integer
  122.   Dim hBrush As Long
  123.  
  124.   Dim PolyCoord(100) As COORD
  125.  
  126.   SetWindowRgn UserControl.hWnd, 0, True
  127.   ScaleMode = vbPixels
  128.   AutoRedraw = True
  129.  
  130.   ' Clear the control (button colour)
  131.    ' -------------------------------------------------------------------
  132.   SetRect rctControl, 0, 0, ScaleWidth, ScaleHeight
  133.   hBrush = CreateSolidBrush(TranslateColour(m_ButtonColour))
  134.   FillRect UserControl.hdc, rctControl, hBrush
  135.   DeleteObject hBrush
  136.  
  137.   ' Remember, X coordinate = Sin(angle) * X radius + X centre, and
  138.    '           Y coordinate = Cos(angle) * Y radius + Y centre
  139.  
  140.  
  141.   ' Draw text
  142.    ' -------------------------------------------------------------------
  143.   Set Font = m_Fount
  144.   DrawText hdc, m_Caption, Len(m_Caption), rctControl, DT_CALCRECT
  145.   If UserControl.Enabled Then
  146.      ForeColor = TranslateColour(m_CaptionColour)
  147.      OffsetRect rctControl, ScaleWidth / 2 - rctControl.Right / 2, _
  148.         ScaleHeight / 2 - rctControl.Bottom / 2
  149.      If booPressed Then
  150.         OffsetRect rctControl, 1, 1
  151.      End If
  152.      DrawText hdc, m_Caption, Len(m_Caption), rctControl, DT_CENTER + DT_VCENTER + DT_NOCLIP
  153.   Else
  154.      ForeColor = TranslateColour(m_LightColour)
  155.      OffsetRect rctControl, ScaleWidth / 2 - rctControl.Right / 2 + 1, _
  156.         ScaleHeight / 2 - rctControl.Bottom / 2 + 1
  157.      DrawText hdc, m_Caption, Len(m_Caption), rctControl, DT_CENTER + DT_VCENTER + DT_NOCLIP
  158.      ForeColor = TranslateColour(m_DarkColour)
  159.      OffsetRect rctControl, -1, -1
  160.      DrawText hdc, m_Caption, Len(m_Caption), rctControl, DT_CENTER + DT_VCENTER + DT_NOCLIP
  161.   End If
  162.  
  163.   ' Draw focus rectangle
  164.    ' -------------------------------------------------------------------
  165.   If booGotFocus And m_ShowFocus Then
  166.      DrawFocusRect hdc, rctControl
  167.   End If
  168.  
  169.   ' Draw the edges
  170.    ' -------------------------------------------------------------------
  171.   For I = 0 To 360 Step 360 / m_iSides
  172.      X(0) = Sin(DegreesToRadians(I + m_iRotation)) * ((ScaleWidth - 1) / 2) + ((ScaleWidth - 1) / 2)
  173.      Y(0) = Cos(DegreesToRadians(I + m_iRotation)) * ((ScaleHeight - 1) / 2) + ((ScaleHeight - 1) / 2)
  174.      X(1) = Sin(DegreesToRadians(I + m_iRotation + 360 / m_iSides)) * ((ScaleWidth - 1) / 2) + ((ScaleWidth - 1) / 2)
  175.      Y(1) = Cos(DegreesToRadians(I + m_iRotation + 360 / m_iSides)) * ((ScaleHeight - 1) / 2) + ((ScaleHeight - 1) / 2)
  176.  
  177.      ' first line
  178.       DrawWidth = 2
  179.       If booPressed Then
  180.          ForeColor = TranslateColour(m_DarkestColour)
  181.       Else
  182.          If (ScaleHeight - (X(1) / ScaleWidth) * ScaleHeight <= Y(1)) Then
  183.             ForeColor = TranslateColour(m_DarkColour)
  184.          Else
  185.             If ScaleHeight - (X(0) / ScaleWidth) * ScaleHeight <= Y(0) Then
  186.                ForeColor = TranslateColour(m_DarkColour)
  187.             Else
  188.                ForeColor = TranslateColour(m_LightestColour)
  189.             End If
  190.          End If
  191.       End If
  192.       MoveToEx hdc, X(0), Y(0), lpOld
  193.       LineTo hdc, X(1), Y(1)
  194.      
  195.       ' second line
  196.      DrawWidth = 1
  197.      If booPressed Then
  198.         ForeColor = TranslateColour(m_DarkColour)
  199.      Else
  200.         If (ScaleHeight - (X(1) / ScaleWidth) * ScaleHeight <= Y(1)) Then
  201.            ForeColor = TranslateColour(m_DarkestColour)
  202.         Else
  203.            If ScaleHeight - (X(0) / ScaleWidth) * ScaleHeight <= Y(0) Then
  204.               ForeColor = TranslateColour(m_DarkestColour)
  205.            Else
  206.               ForeColor = TranslateColour(m_LightColour)
  207.            End If
  208.         End If
  209.      End If
  210.      MoveToEx hdc, X(0) + 1, Y(0) + 1, lpOld
  211.      LineTo hdc, X(1) + 1, Y(1) + 1
  212.   Next
  213.  
  214.   ' Create polygon region
  215.    ' -------------------------------------------------------------------
  216.   For I = 0 To 360 Step 360 / m_iSides
  217.      PolyCoord(iCounter).X = Sin(DegreesToRadians(I + m_iRotation)) * ((ScaleWidth + 1) / 2) + ((ScaleWidth + 1) / 2)
  218.      PolyCoord(iCounter).Y = Cos(DegreesToRadians(I + m_iRotation)) * ((ScaleHeight + 1) / 2) + ((ScaleHeight + 1) / 2)
  219.      iCounter = iCounter + 1
  220.   Next
  221.   hRegion = CreatePolygonRgn(PolyCoord(0), m_iSides, WINDING)
  222.   SetWindowRgn UserControl.hWnd, hRegion, True
  223.  
  224.   ' Because we've set AutoRedraw to True...
  225.   Refresh
  226. End Sub
  227.  
  228. Private Sub UserControl_Click()
  229.   RaiseEvent Click
  230. End Sub
  231.  
  232. Private Sub UserControl_DblClick()
  233.   RaiseEvent DblClick
  234. End Sub
  235.  
  236. Private Sub UserControl_ExitFocus()
  237.   booGotFocus = False
  238.   DrawControl
  239. End Sub
  240.  
  241. Private Sub UserControl_GotFocus()
  242.   booGotFocus = True
  243.   DrawControl
  244. End Sub
  245.  
  246. Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer)
  247.   RaiseEvent KeyDown(KeyCode, Shift)
  248. End Sub
  249.  
  250. Private Sub UserControl_KeyPress(KeyAscii As Integer)
  251.   RaiseEvent KeyPress(KeyAscii)
  252. End Sub
  253.  
  254. Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer)
  255.   RaiseEvent KeyUp(KeyCode, Shift)
  256. End Sub
  257.  
  258. Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  259.   If Button = vbLeftButton Then
  260.      DrawControl True '(PtInRegion(hRegion, X, Y) <> 0)
  261.    End If
  262. End Sub
  263.  
  264. Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  265.    If Button = vbLeftButton Then
  266.       DrawControl True
  267.    End If
  268. End Sub
  269.  
  270. Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  271.    If Button = vbLeftButton Then
  272.       DrawControl
  273.    End If
  274. End Sub
  275.  
  276. '---------------------------------------------------------------------------------------
  277. ' Procedure : bsPolygonButton.UserControl_ReadProperties
  278. ' DateTime  : 08/11/2003
  279. ' Author    : Drew (aka The Bad One)
  280. ' Purpose   : Reads the stored values for the properties.
  281. ' Assuming  : nothing
  282. '---------------------------------------------------------------------------------------
  283. '
  284. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  285.    m_iSides = PropBag.ReadProperty("Sides", m_def_iSides)
  286.    m_iRotation = PropBag.ReadProperty("Rotation", m_def_iRotation)
  287.    m_LightestColour = PropBag.ReadProperty("LightestColour", m_def_LightestColour)
  288.    m_LightColour = PropBag.ReadProperty("LightColour", m_def_LightColour)
  289.    m_DarkColour = PropBag.ReadProperty("DarkColour", m_def_DarkColour)
  290.    m_DarkestColour = PropBag.ReadProperty("DarkestColour", m_def_DarkestColour)
  291.    m_Caption = PropBag.ReadProperty("Caption", UserControl.Extender.Name)
  292.    m_ButtonColour = PropBag.ReadProperty("ButtonColour", m_def_ButtonColour)
  293.    Set m_Fount = PropBag.ReadProperty("Fount", Ambient.Font)
  294.    m_CaptionColour = PropBag.ReadProperty("CaptionColour", m_def_CaptionColour)
  295.    UserControl.Enabled = PropBag.ReadProperty("Enabled", True)
  296.    m_ShowFocus = PropBag.ReadProperty("ShowFocus", m_def_ShowFocus)
  297. End Sub
  298.  
  299. Private Sub UserControl_Resize()
  300.    DrawControl
  301. End Sub
  302.  
  303. '---------------------------------------------------------------------------------------
  304. ' Procedure : bsPolygonButton.Rotation
  305. ' DateTime  : 08/11/2003
  306. ' Author    : Drew (aka The Bad One)
  307. ' Purpose   : Allows the user to specify by how much the polygon is
  308. '             "rotated".
  309. ' Assuming  : nothing
  310. '---------------------------------------------------------------------------------------
  311. '
  312. Public Property Get Rotation() As Integer
  313.   Rotation = m_iRotation
  314. End Property
  315.  
  316. '---------------------------------------------------------------------------------------
  317. ' Procedure : bsPolygonButton.Rotation
  318. ' DateTime  : 08/11/2003
  319. ' Author    : Drew (aka The Bad One)
  320. ' Purpose   : Allows the user to specify by how much the polygon is
  321. '             "rotated".
  322. ' Assuming  : nothing
  323. '---------------------------------------------------------------------------------------
  324. '
  325. Public Property Let Rotation(ByVal New_Rotation As Integer)
  326.    New_Rotation = New_Rotation Mod 360
  327.    If New_Rotation < 0 Then
  328.       New_Rotation = 360 - New_Rotation
  329.    End If
  330.    m_iRotation = New_Rotation
  331.    PropertyChanged "Rotation"
  332.    DrawControl
  333. End Property
  334.  
  335. '---------------------------------------------------------------------------------------
  336. ' Procedure : bsPolygonButton.UserControl_InitProperties
  337. ' DateTime  : 08/11/2003
  338. ' Author    : Drew (aka The Bad One)
  339. ' Purpose   : Sets the default values for the properties.
  340. ' Assuming  : nothing
  341. '---------------------------------------------------------------------------------------
  342. '
  343. Private Sub UserControl_InitProperties()
  344.    m_iRotation = m_def_iRotation
  345.    m_iSides = m_def_iSides
  346.    m_LightestColour = m_def_LightestColour
  347.    m_LightColour = m_def_LightColour
  348.    m_DarkColour = m_def_DarkColour
  349.    m_DarkestColour = m_def_DarkestColour
  350.    m_Caption = Extender.Name
  351.    m_ButtonColour = m_def_ButtonColour
  352.    Set m_Fount = Ambient.Font
  353.    m_CaptionColour = m_def_CaptionColour
  354.    m_ShowFocus = m_def_ShowFocus
  355. End Sub
  356.  
  357. '---------------------------------------------------------------------------------------
  358. ' Procedure : bsPolygonButton.UserControl_Terminate
  359. ' DateTime  : 09/11/2003
  360. ' Author    : Drew (aka The Bad One)
  361. ' Purpose   : Removes the region from memory, before the control is destroyed.
  362. ' Assuming  : nothing
  363. '---------------------------------------------------------------------------------------
  364. '
  365. Private Sub UserControl_Terminate()
  366.    DeleteObject hRegion
  367. End Sub
  368.  
  369. '---------------------------------------------------------------------------------------
  370. ' Procedure : bsPolygonButton.UserControl_WriteProperties
  371. ' DateTime  : 08/11/2003
  372. ' Author    : Drew (aka The Bad One)
  373. ' Purpose   : "Saves" the properties for later use.
  374. ' Assuming  : nothing
  375. '---------------------------------------------------------------------------------------
  376. '
  377. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  378.    Call PropBag.WriteProperty("Sides", m_iSides, m_def_iSides)
  379.    Call PropBag.WriteProperty("Rotation", m_iRotation, m_def_iRotation)
  380.    Call PropBag.WriteProperty("LightestColour", m_LightestColour, m_def_LightestColour)
  381.    Call PropBag.WriteProperty("LightColour", m_LightColour, m_def_LightColour)
  382.    Call PropBag.WriteProperty("DarkColour", m_DarkColour, m_def_DarkColour)
  383.    Call PropBag.WriteProperty("DarkestColour", m_DarkestColour, m_def_DarkestColour)
  384.    Call PropBag.WriteProperty("Caption", m_Caption, UserControl.Extender.Name)
  385.    Call PropBag.WriteProperty("ButtonColour", m_ButtonColour, m_def_ButtonColour)
  386.    Call PropBag.WriteProperty("Fount", m_Fount, Ambient.Font)
  387.    Call PropBag.WriteProperty("CaptionColour", m_CaptionColour, m_def_CaptionColour)
  388.    Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True)
  389.    Call PropBag.WriteProperty("ShowFocus", m_ShowFocus, m_def_ShowFocus)
  390. End Sub
  391.  
  392. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  393. 'MemberInfo=10,0,0,0
  394. Public Property Get LightestColour() As OLE_COLOR
  395.    LightestColour = m_LightestColour
  396. End Property
  397.  
  398. Public Property Let LightestColour(ByVal New_LightestColour As OLE_COLOR)
  399.    m_LightestColour = New_LightestColour
  400.    PropertyChanged "LightestColour"
  401.    DrawControl
  402. End Property
  403.  
  404. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  405. 'MemberInfo=10,0,0,0
  406. Public Property Get LightColour() As OLE_COLOR
  407.    LightColour = m_LightColour
  408. End Property
  409.  
  410. Public Property Let LightColour(ByVal New_LightColour As OLE_COLOR)
  411.    m_LightColour = New_LightColour
  412.    PropertyChanged "LightColour"
  413.    DrawControl
  414. End Property
  415.  
  416. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  417. 'MemberInfo=10,0,0,0
  418. Public Property Get DarkColour() As OLE_COLOR
  419.    DarkColour = m_DarkColour
  420. End Property
  421.  
  422. Public Property Let DarkColour(ByVal New_DarkColour As OLE_COLOR)
  423.    m_DarkColour = New_DarkColour
  424.    PropertyChanged "DarkColour"
  425.    DrawControl
  426. End Property
  427.  
  428. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  429. 'MemberInfo=10,0,0,0
  430. Public Property Get DarkestColour() As OLE_COLOR
  431.    DarkestColour = m_DarkestColour
  432. End Property
  433.  
  434. Public Property Let DarkestColour(ByVal New_DarkestColour As OLE_COLOR)
  435.    m_DarkestColour = New_DarkestColour
  436.    PropertyChanged "DarkestColour"
  437.    DrawControl
  438. End Property
  439.  
  440. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  441. 'MemberInfo=13,0,0,usercontrol.extender.name
  442. Public Property Get Caption() As String
  443.    Caption = m_Caption
  444. End Property
  445.  
  446. Public Property Let Caption(ByVal New_Caption As String)
  447.    m_Caption = New_Caption
  448.    PropertyChanged "Caption"
  449.    DrawControl
  450. End Property
  451.  
  452. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  453. 'MemberInfo=10,0,0,vbbuttonface
  454. Public Property Get ButtonColour() As OLE_COLOR
  455.    ButtonColour = m_ButtonColour
  456. End Property
  457.  
  458. Public Property Let ButtonColour(ByVal New_ButtonColour As OLE_COLOR)
  459.    m_ButtonColour = New_ButtonColour
  460.    PropertyChanged "ButtonColour"
  461.    DrawControl
  462. End Property
  463.  
  464. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  465. 'MemberInfo=6,0,0,0
  466. Public Property Get Fount() As Font
  467.    Set Fount = m_Fount
  468. End Property
  469.  
  470. Public Property Set Fount(ByVal New_Fount As Font)
  471.    Set m_Fount = New_Fount
  472.    PropertyChanged "Fount"
  473.    DrawControl
  474. End Property
  475.  
  476. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  477. 'MemberInfo=10,0,0,vbbuttontext
  478. Public Property Get CaptionColour() As OLE_COLOR
  479.    CaptionColour = m_CaptionColour
  480. End Property
  481.  
  482. Public Property Let CaptionColour(ByVal New_CaptionColour As OLE_COLOR)
  483.    m_CaptionColour = New_CaptionColour
  484.    PropertyChanged "CaptionColour"
  485.    DrawControl
  486. End Property
  487.  
  488. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  489. 'MappingInfo=UserControl,UserControl,-1,Enabled
  490. Public Property Get Enabled() As Boolean
  491.    Enabled = UserControl.Enabled
  492. End Property
  493.  
  494. Public Property Let Enabled(ByVal New_Enabled As Boolean)
  495.    UserControl.Enabled() = New_Enabled
  496.    PropertyChanged "Enabled"
  497.    DrawControl
  498. End Property
  499.  
  500. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  501. 'MemberInfo=0,0,0,True
  502. Public Property Get ShowFocus() As Boolean
  503.    ShowFocus = m_ShowFocus
  504. End Property
  505.  
  506. Public Property Let ShowFocus(ByVal New_ShowFocus As Boolean)
  507.    m_ShowFocus = New_ShowFocus
  508.    PropertyChanged "ShowFocus"
  509. End Property
  510.  
  511. '---------------------------------------------------------------------------------------
  512. ' Procedure : modUseful.DegreesToRadians
  513. ' DateTime  : 08/11/2003
  514. ' Author    : Drew (aka The Bad One)
  515. ' Purpose   : Converts a value in degrees to radians, as used by Visual Basic.
  516. ' Assuming  : nothing
  517. '---------------------------------------------------------------------------------------
  518. '
  519. Function DegreesToRadians(ByVal sngAngle As Single) As Single
  520.    DegreesToRadians = sngAngle * (Pi / 180)
  521. End Function
  522. '---------------------------------------------------------------------------------------
  523. ' Procedure : TranslateColour
  524. ' DateTime  : 12/10/2003
  525. ' Author    : Drew (aka The Bad One)
  526. ' Purpose   : Used to convert Automation colours to a Windows (long) colour.
  527. '---------------------------------------------------------------------------------------
  528. '
  529. Function TranslateColour(ByVal oClr As OLE_COLOR, Optional hPal As Long = 0) As Long
  530.   If TranslateColor(oClr, hPal, TranslateColour) Then
  531.       TranslateColour = CLR_INVALID
  532.   End If
  533. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement