>DEFINE CLASS ButtonLabel AS container > > Width = 71 > Height = 35 > BackStyle = 0 > BorderWidth = 0 > Name = "ButtonLabel" > > ADD OBJECT label1 AS label WITH ; > AutoSize = .T., Caption = "Menu1", ; > Height = 17, Left = 17, Top = 10, Width = 39, ; > TabIndex = 1, ; > Name = "Label1" > > ADD OBJECT line_1 AS line WITH ; > Height = 0, Left = 3, Top = 3, Width = 63, ; > Name = "Line_1" > > ADD OBJECT line_2 AS line WITH ; > Height = 28, Left = 3, Top = 3, Width = 0, ; > Name = "Line_2" > > ADD OBJECT line_3 AS line WITH ; > Height = 0, Left = 3, Top = 31, Width = 63, ; > Name = "Line_3" > > ADD OBJECT line_4 AS line WITH ; > Height = 28, Left = 66, Top = 3, Width = 0, ; > Name = "Line_4" > > > PROCEDURE Init > If (type('ThisForm.nLightColor') == 'U') > Declare Long GetSysColor in User32 Integer nIndex > With ThisForm > .AddProperty( 'nLightColor', GetSysColor(20) ) > .AddProperty( 'nShadowColor', GetSysColor(16) ) > .AddProperty( 'oMenuActive', Null ) > EndWith > Clear Dlls GetSysColor > endif > > With This > .SetAll( 'BorderStyle', 0, 'Line' ) > .Label1.Visible = .T. > .Height = .Label1.Height + 8 > .Width = .Label1.Width + 15 > > .Line_1.Left = 1 > .Line_1.Top = 1 > .Line_1.Width = .Width > .Line_1.BorderColor = ThisForm.nLightColor > > .Line_2.Left = 1 > .Line_2.Top = 1 > .Line_2.Height = .Height > .Line_2.BorderColor = ThisForm.nLightColor > > .Line_3.Left = 1 > .Line_3.Top = .Height - 1 > .Line_3.Width = .Width > .Line_3.BorderColor = ThisForm.nShadowColor > > .Line_4.Left = .Width - 1 > .Line_4.Top = 1 > .Line_4.Height = .Height > .Line_4.BorderColor = ThisForm.nShadowColor > EndWith > ENDPROC > > > PROCEDURE MouseEnter > LPARAMETERS nButton, nShift, nXCoord, nYCoord > > If (nButton == 0) > With ThisForm > If !IsNull( .oMenuActive ) and ( .oMenuActive.Name != This.Name ) > .oMenuActive = Null > endif > > If IsNull( .oMenuActive ) > This.SetAll( 'BorderStyle', 1, 'Line' ) > .oMenuActive = This > endif > EndWith > endif > ENDPROC > > > PROCEDURE MouseLeave > LPARAMETERS nButton, nShift, nXCoord, nYCoord > > If (nButton == 0) > This.SetAll( 'BorderStyle', 0, 'Line' ) > ThisForm.oMenuActive = Null > endif > ENDPROC > > > PROCEDURE MouseDown > LPARAMETERS nButton, nShift, nXCoord, nYCoord > > If (nButton == 1) > With This > .Line_1.BorderColor = ThisForm.nShadowColor > .Line_2.BorderColor = ThisForm.nShadowColor > .Line_3.BorderColor = ThisForm.nLightColor > .Line_4.BorderColor = ThisForm.nLightColor > .Label1.Top = .Label1.Top + 1 > .Label1.Left = .Label1.Left + 1 > EndWith > endif > ENDPROC > > > PROCEDURE MouseUp > LPARAMETERS nButton, nShift, nXCoord, nYCoord > > If (nButton == 1) > With This > .Label1.Top = .Label1.Top - 1 > .Label1.Left = .Label1.Left - 1 > .Line_1.BorderColor = ThisForm.nLightColor > .Line_2.BorderColor = ThisForm.nLightColor > .Line_3.BorderColor = ThisForm.nShadowColor > .Line_4.BorderColor = ThisForm.nShadowColor > EndWith > endif > ENDPROC > > > PROCEDURE label1.Init > With This > .Top = 4 > .Left = 9 > EndWith > ENDPROC > > > PROCEDURE label1.MouseDown > LPARAMETERS nButton, nShift, nXCoord, nYCoord > > If (nButton == 1) > This.Parent.MouseDown( nButton, nShift, nXCoord, nYCoord ) > endif > ENDPROC > > > PROCEDURE label1.MouseUp > LPARAMETERS nButton, nShift, nXCoord, nYCoord > > If (nButton == 1) > This.Parent.MouseUp( nButton, nShift, nXCoord, nYCoord ) > endif > ENDPROC > > >ENDDEFINE >