如何讓滑鼠游標移到PictureBox上可以變色 |
尚未結案
|
超級賽亞人3
一般會員 發表:38 回覆:53 積分:23 註冊:2007-06-05 發送簡訊給我 |
各位大大
想請問如何讓滑鼠游標移到PictureBox上可以變色 移走後又可以恢復原色 下面的程式我寫了 但只能執行一次 該怎麼修改才能達到滑鼠移到 PictureBox上變色 移走後又可以變回原色,且一直循環 [code vb] Public Class Dim bool7 As Boolean = True '開關 Dim bool8 As Boolean = True '開關 '書籤游標效果 '定位------------------------------------------------------------------------------------ Private Sub Label1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter bool7 = True End Sub Private Sub PictureBox1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter bool8 = True End Sub Private Sub Label1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseLeave bool7 = False ch1(bool7, bool8) End Sub Private Sub PictureBox1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseLeave bool8 = False ch1(bool7, bool8) End Sub Sub ch1(ByRef a, ByRef b) If (a = True Or b = True) Then PictureBox1.BackColor = Color.FromArgb(255, 196, 222, 247) Label1.BackColor = Color.FromArgb(255, 196, 222, 247) Else Timer1.Enabled = True End If End Sub '分頁滑鼠游標 timer控制----------------------------------------------------------------------- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.BackColor = Color.FromArgb(255, 240, 240, 240) PictureBox1.BackColor = Color.FromArgb(255, 240, 240, 240) 'Timer1.Enabled = False End Sub End Class [/code] |
超級賽亞人3
一般會員 發表:38 回覆:53 積分:23 註冊:2007-06-05 發送簡訊給我 |
解決了
例子如下 網路上看到一些例子有用timer,感覺很複雜 後來仔細想想自己要的功能,在這不需要使用timer就能達成 [code vb] Private Sub Label8_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label8.MouseEnter PictureBox22.BackColor = Color.FromArgb(196, 222, 247) Label8.BackColor = Color.FromArgb(196, 222, 247) End Sub Private Sub Label8_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label8.MouseLeave PictureBox22.BackColor = Color.FromArgb(240, 240, 240) Label8.BackColor = Color.FromArgb(240, 240, 240) End Sub Private Sub PictureBox22_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox22.MouseEnter PictureBox22.BackColor = Color.FromArgb(196, 222, 247) Label8.BackColor = Color.FromArgb(196, 222, 247) End Sub Private Sub PictureBox22_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox22.MouseLeave PictureBox22.BackColor = Color.FromArgb(240, 240, 240) Label8.BackColor = Color.FromArgb(240, 240, 240) [/code] |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |