Results 1 to 3 of 3

Thread: [RESOLVED] Bistate button

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    28

    [RESOLVED] Bistate button

    I'm tring to change the form gradient color with single button.
    Like if the 1st color is aplied Command1_Click and set 2nd color
    VB Code:
    1. Private Sub Command1_Click()
    2.     If Command1 = 0 Then
    3.     Call Gradient(Me, "H", vbRed, vbGreen)
    4.     Command1 = 1
    5.     Else
    6.     Call Gradient(Me, "H", RGB(RGBcolor.r - 40, RGBcolor.g - 40, RGBcolor.b - 40), _
    7.     RGB(RGBcolor.r, RGBcolor.g, RGBcolor.b))
    8.     Command1 = 0
    9.     End If
    10. End Sub
    Last edited by eJan; Apr 9th, 2006 at 09:46 AM. Reason: resolved

  2. #2
    Addicted Member BlueRose's Avatar
    Join Date
    Jan 2002
    Location
    ISTANBUL
    Posts
    245

    Re: Bistate button

    use Tag property of control.

    VB Code:
    1. Private Sub Form_Load()
    2.     Command1.Tag = 0
    3. End Sub
    4.  
    5. Private Sub Command1_Click()
    6.     If [COLOR=Red]Command1.Tag[/COLOR] = 0 Then
    7.     Call Gradient(Me, "H", vbRed, vbGreen)
    8.     [COLOR=Red]Command1.Tag [/COLOR] = 1
    9.     Else
    10.     Call Gradient(Me, "H", RGB(RGBcolor.r - 40, RGBcolor.g - 40, RGBcolor.b - 40), _
    11.     RGB(RGBcolor.r, RGBcolor.g, RGBcolor.b))
    12.     [COLOR=Red]Command1.Tag[/COLOR] = 0
    13.     End If
    14. End Sub
    You can do while you think that you can do

    If you think my answer solve your question, please rate it.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    28

    Thumbs up Re: Bistate button

    Thanks BlueRose!, this is what I need.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width