2019年4月22日 星期一

調色盤ColorV11



Public Class Form1

    Dim R As Integer
    Dim G As Integer
    Dim B As Integer
    Dim A As Integer

    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        R = TrackBar1.Value
        Call SetColor()
    End Sub

    Private Sub TrackBar2_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar2.Scroll
        G = TrackBar2.Value
        Call SetColor()
    End Sub

    Private Sub TrackBar3_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar3.Scroll
        B = TrackBar3.Value
        Call SetColor()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        R = Val(InputBox("請輸入紅色", "紅", 128))
        G = Val(InputBox("請輸入綠色", "綠", 128))
        B = Val(InputBox("請輸入藍色", "藍", 128))
        Call SetColor()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        R = Val(TextBox1.Text)
        G = Val(TextBox2.Text)
        B = Val(TextBox3.Text)
        Call SetColor()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        A = MsgBox("您的色彩有" + "  紅色=" & R & "  綠色=" & G & "  藍色=" & B, MsgBoxStyle.YesNo + MsgBoxStyle.Information, "調色盤")
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        R = TrackBar1.Value + 10
        Call SetColor()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        R = TrackBar1.Value + 1
        Call SetColor()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        R = TrackBar1.Value - 1
        Call SetColor()
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        R = TrackBar1.Value - 10
        Call SetColor()
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        G = TrackBar2.Value + 10
        Call SetColor()
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        G = TrackBar2.Value + 1
        Call SetColor()
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        G = TrackBar2.Value - 1
        Call SetColor()
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        G = TrackBar2.Value - 10
        Call SetColor()
    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        B = TrackBar3.Value + 10
        Call SetColor()
    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        B = TrackBar3.Value + 1
        Call SetColor()
    End Sub

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        B = TrackBar3.Value - 1
        Call SetColor()
    End Sub

    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        B = TrackBar3.Value - 10
        Call SetColor()
    End Sub

    Sub SetColor()
        If R > 255 Then
            R = 255
        ElseIf R < 0 Then
            R = 0
        End If
        If G > 255 Then
            G = 255
        ElseIf G < 0 Then
            G = 0
        End If
        If B > 255 Then
            B = 255
        ElseIf B < 0 Then
            B = 0
        End If

        TrackBar1.Value = R
        TrackBar2.Value = G
        TrackBar3.Value = B

        HScrollBar1.Value = R
        HScrollBar2.Value = G
        HScrollBar3.Value = B

        VScrollBar1.Value = R
        VScrollBar2.Value = G
        VScrollBar3.Value = B


        Label1.Text = R
        Label2.Text = G
        Label3.Text = B

        TextBox1.Text = R
        TextBox2.Text = G
        TextBox3.Text = B

        PictureBox1.BackColor = Color.FromArgb(R, 0, 0)
        PictureBox2.BackColor = Color.FromArgb(0, G, 0)
        PictureBox3.BackColor = Color.FromArgb(0, 0, B)

        PictureBox4.BackColor = Color.FromArgb(R, G, B)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        R = TrackBar1.Value
        G = TrackBar2.Value
        B = TrackBar3.Value
        Call SetColor()
    End Sub

    Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
        R = HScrollBar1.Value
        Call SetColor()
    End Sub

    Private Sub HScrollBar2_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar2.Scroll
        G = HScrollBar2.Value
        Call SetColor()
    End Sub

    Private Sub HScrollBar3_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar3.Scroll
        B = HScrollBar3.Value
        Call SetColor()
    End Sub

    Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
        R = VScrollBar1.Value
        Call SetColor()
    End Sub

    Private Sub VScrollBar2_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar2.Scroll
        G = VScrollBar2.Value
        Call SetColor()
    End Sub

    Private Sub VScrollBar3_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar3.Scroll
        B = VScrollBar3.Value
        Call SetColor()
    End Sub
End Class

19 則留言:

  1. 哈哈哈哈哈哈哈哈哈阿哈哈哈哈哈哈ㄚㄚㄚ哈ㄏ

    回覆刪除
  2. 我沒有腹肌 但我有ㄒ炸雞

    回覆刪除
  3. 0800-200-885霸凌專線喔喔 喔喔喔喔喔

    回覆刪除
  4. 0800-63-63-63 戒菸專線喔喔喔喔喔喔喔

    回覆刪除
  5. 複製+貼上
    https://www.google.com/search?rlz=1C1CHNU_enTW476TW476&ei=LX_KXPy_BYry8QWl5I24BQ&q=%E5%85%8D%E8%B2%BB%E5%89%AA%E9%AB%AE%E8%AA%B2%E7%A8%8B&oq=%E5%85%8D%E8%B2%BB%E6%B8%9B%E6%B3%95&gs_l=psy-ab.1.0.0i13.2216.22320..25420...16.0..0.96.1167.21......0....1..gws-wiz.....6..35i39j0i131j0j0i67j0i131i67j0i3j0i30j0i5i30.q7Kk4ZVWYRU

    回覆刪除