home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / BUTTON.ZIP / VB6B.ctl < prev    next >
Encoding:
Text File  |  1999-05-18  |  4.3 KB  |  180 lines

  1. VERSION 5.00
  2. Begin VB.UserControl VB6B 
  3.    ClientHeight    =   3600
  4.    ClientLeft      =   0
  5.    ClientTop       =   0
  6.    ClientWidth     =   4800
  7.    MouseIcon       =   "VB6B.ctx":0000
  8.    MousePointer    =   99  'Custom
  9.    ScaleHeight     =   3600
  10.    ScaleWidth      =   4800
  11.    ToolboxBitmap   =   "VB6B.ctx":0152
  12.    Begin VB.Timer Timer2 
  13.       Enabled         =   0   'False
  14.       Interval        =   100
  15.       Left            =   3375
  16.       Top             =   2475
  17.    End
  18.    Begin VB.Timer Timer1 
  19.       Enabled         =   0   'False
  20.       Interval        =   75
  21.       Left            =   3960
  22.       Top             =   1440
  23.    End
  24.    Begin VB.CommandButton CB 
  25.       Appearance      =   0  'Flat
  26.       Caption         =   "VB6Button"
  27.       BeginProperty Font 
  28.          Name            =   "Comic Sans MS"
  29.          Size            =   9.75
  30.          Charset         =   0
  31.          Weight          =   400
  32.          Underline       =   0   'False
  33.          Italic          =   0   'False
  34.          Strikethrough   =   0   'False
  35.       EndProperty
  36.       Height          =   555
  37.       Left            =   660
  38.       MouseIcon       =   "VB6B.ctx":0464
  39.       MousePointer    =   99  'Custom
  40.       Style           =   1  'Graphical
  41.       TabIndex        =   0
  42.       TabStop         =   0   'False
  43.       Top             =   720
  44.       Width           =   1395
  45.    End
  46. End
  47. Attribute VB_Name = "VB6B"
  48. Attribute VB_GlobalNameSpace = False
  49. Attribute VB_Creatable = True
  50. Attribute VB_PredeclaredId = False
  51. Attribute VB_Exposed = True
  52. Public X1, Y1, X2, Y2
  53. Event Click()
  54. Event MuoviMouse()
  55.  
  56. Private Function eDentro() As Boolean
  57.     Dim ptMouse As POINTAPI
  58.  
  59.     GetCursorPos ptMouse
  60.     If (WindowFromPoint(ptMouse.X, ptMouse.Y) = CB.hWnd) Or (WindowFromPoint(ptMouse.X, ptMouse.Y) = UserControl.hWnd) Then
  61.         eDentro = True
  62.     Else
  63.         eDentro = False
  64.     End If
  65.  
  66. End Function
  67.  
  68.  
  69.  
  70. Public Property Get Label() As String
  71.    Label = CB.Caption
  72. End Property
  73. Public Property Let Label(ByVal NuovaLbl As String)
  74.    CB.Caption = NuovaLbl
  75.    PropertyChanged "Label"
  76. End Property
  77.  
  78.  
  79.  
  80. Private Sub CB_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  81.     If Tempo <> 0 Then Exit Sub
  82.     Timer1.Enabled = True
  83.  
  84. End Sub
  85.  
  86. Private Sub CB_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  87. If Tempo <> 0 Then
  88.     Exit Sub
  89. End If
  90.  
  91. Timer2.Enabled = True
  92. RaiseEvent MuoviMouse
  93.  
  94. End Sub
  95.  
  96.  
  97. Private Sub Timer1_Timer()
  98. If UserControl.BorderStyle = 0 Then
  99.     UserControl.BorderStyle = 1
  100. Else
  101.     UserControl.BorderStyle = 0
  102. End If
  103. Tempo = Tempo + 1
  104. If Tempo = 6 Then
  105.     UserControl.BorderStyle = 0
  106.     CB.FontBold = False
  107.     Line (X1, Y1)-(X2, Y2), UserControl.BackColor, B
  108.     Tempo = 0
  109.     Timer1.Enabled = False
  110.     RaiseEvent Click
  111.  
  112. End If
  113.  
  114. End Sub
  115.  
  116. Private Sub Timer2_Timer()
  117. If eDentro Then
  118.     'mouse dentro
  119.     If Not CB.FontBold Then CB.FontBold = True
  120.     Line (X1, Y1)-(X2, Y2), QBColor(0), B
  121. Else
  122.     'mouse fuori
  123.     CB.FontBold = False
  124.     Line (X1, Y1)-(X2, Y2), UserControl.BackColor, B
  125.     Timer2.Enabled = False
  126. End If
  127.  
  128. End Sub
  129.  
  130. Private Sub UserControl_InitProperties()
  131. Timer1.Enabled = False
  132. Timer2.Enabled = False
  133. Tempo = 0
  134. End Sub
  135.  
  136. Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  137.     If Tempo <> 0 Then Exit Sub
  138.     Timer1.Enabled = True
  139.     
  140. End Sub
  141.  
  142. Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  143. If Tempo <> 0 Then
  144.     Exit Sub
  145. End If
  146.  
  147. Timer2.Enabled = True
  148. RaiseEvent MuoviMouse
  149. End Sub
  150.  
  151. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  152. Label = PropBag.ReadProperty("Label", "")
  153.  
  154. End Sub
  155.  
  156. Private Sub UserControl_Resize()
  157. On Error Resume Next
  158. UserControl.Picture = UserControl.Extender.Container.Picture
  159. CB.Picture = UserControl.Extender.Container.Picture
  160.  
  161. 'UserControl.Height = 400
  162. UserControl.BackColor = UserControl.Ambient.BackColor
  163. dx = UserControl.Width
  164. dy = UserControl.Height
  165. CB.Left = 1 / 100 * dx
  166. CB.Top = 2 / 100 * dy
  167. CB.Width = dx - 2 * CB.Left
  168. CB.Height = dy - 2 * CB.Top
  169. X1 = CB.Left / 2
  170. Y1 = CB.Top / 2
  171. X2 = CB.Left + CB.Width
  172. Y2 = CB.Top + CB.Height
  173.  
  174. End Sub
  175.  
  176. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  177. PropBag.WriteProperty "Label", Label, ""
  178. End Sub
  179.  
  180.