0
私は30個のボタンを設定し、それらにタグ1-30を割り当てました。私はタグを使用する方法を探しているので、30の背景色のそれぞれを変更するループを使用することができます。ここで私はそれがセットアップを持っているが、ループを使いたいと思う方法です。ここでボタンのタグを使用してボタンの背景を変更する
Pb_Seg1.BackColor = Color.FromArgb(intRed(intStepNumber), intGreen(intStepNumber), intBlue(intStepNumber))
Pb_Seg2.BackColor = Color.FromArgb(intRed(intStepNumber), intGreen(intStepNumber), intBlue(intStepNumber))
Pb_Seg3.BackColor = Color.FromArgb(intRed(intStepNumber), intGreen(intStepNumber), intBlue(intStepNumber))
Pb_Seg4.BackColor = Color.FromArgb(intRed(intStepNumber), intGreen(intStepNumber), intBlue(intStepNumber))
Pb_Seg5.BackColor = Color.FromArgb(intRed(intStepNumber), intGreen(intStepNumber), intBlue(intStepNumber))
は、私は、タグの問題を解決しました
Private Sub Segment(sender As Object, e As EventArgs) Handles Pb_Seg99.MouseHover, Pb_Seg99.Click, Pb_Seg98.MouseHover, Pb_Seg98.Click, Pb_Seg97.MouseHover, Pb_Seg97.Click, Pb_Seg96.MouseHover, Pb_Seg96.Click, Pb_Seg95.MouseHover, Pb_Seg95.Click, Pb_Seg94.MouseHover, Pb_Seg94.Click, Pb_Seg93.MouseHover, Pb_Seg93.Click, Pb_Seg92.MouseHover, Pb_Seg92.Click, Pb_Seg91.MouseHover, Pb_Seg91.Click, Pb_Seg90.MouseHover, Pb_Seg90.Click, Pb_Seg9.MouseHover, Pb_Seg9.Click, Pb_Seg89.MouseHover, Pb_Seg89.Click, Pb_Seg88.MouseHover, Pb_Seg88.Click, Pb_Seg87.MouseHover, Pb_Seg87.Click, Pb_Seg86.MouseHover, Pb_Seg86.Click, Pb_Seg85.MouseHover, Pb_Seg85.Click, Pb_Seg84.MouseHover, Pb_Seg84.Click, Pb_Seg83.MouseHover, Pb_Seg83.Click, Pb_Seg82.MouseHover, Pb_Seg82.Click, Pb_Seg81.MouseHover, Pb_Seg81.Click, Pb_Seg80.MouseHover, Pb_Seg80.Click, Pb_Seg8.MouseHover, Pb_Seg8.Click, Pb_Seg79.MouseHover, Pb_Seg79.Click, Pb_Seg78.MouseHover, Pb_Seg78.Click, Pb_Seg77.MouseHover, Pb_Seg77.Click, Pb_Seg76.MouseHover, Pb_Seg76.Click, Pb_Seg75.MouseHover, Pb_Seg75.Click, Pb_Seg74.MouseHover, Pb_Seg74.Click, Pb_Seg73.MouseHover, Pb_Seg73.Click, Pb_Seg72.MouseHover, Pb_Seg72.Click, Pb_Seg71.MouseHover, Pb_Seg71.Click, Pb_Seg70.MouseHover, Pb_Seg70.Click, Pb_Seg7.MouseHover, Pb_Seg7.Click, Pb_Seg69.MouseHover, Pb_Seg69.Click, Pb_Seg68.MouseHover, Pb_Seg68.Click, Pb_Seg67.MouseHover, Pb_Seg67.Click, Pb_Seg66.MouseHover, Pb_Seg66.Click, Pb_Seg65.MouseHover, Pb_Seg65.Click, Pb_Seg64.MouseHover, Pb_Seg64.Click, Pb_Seg63.MouseHover, Pb_Seg63.Click, Pb_Seg62.MouseHover, Pb_Seg62.Click, Pb_Seg61.MouseHover, Pb_Seg61.Click, Pb_Seg60.MouseHover, Pb_Seg60.Click, Pb_Seg6.MouseHover, Pb_Seg6.Click, Pb_Seg59.MouseHover, Pb_Seg59.Click, Pb_Seg58.MouseHover, Pb_Seg58.Click, Pb_Seg57.MouseHover, Pb_Seg57.Click, Pb_Seg56.MouseHover, Pb_Seg56.Click, Pb_Seg55.MouseHover, Pb_Seg55.Click, Pb_Seg54.MouseHover, Pb_Seg54.Click, Pb_Seg53.MouseHover, Pb_Seg53.Click, Pb_Seg52.MouseHover, Pb_Seg52.Click, Pb_Seg51.MouseHover, Pb_Seg51.Click, Pb_Seg50.MouseHover, Pb_Seg50.Click, Pb_Seg5.MouseHover, Pb_Seg5.Click, Pb_Seg49.MouseHover, Pb_Seg49.Click, Pb_Seg48.MouseHover, Pb_Seg48.Click, Pb_Seg47.MouseHover, Pb_Seg47.Click, Pb_Seg46.MouseHover, Pb_Seg46.Click, Pb_Seg45.MouseHover, Pb_Seg45.Click, Pb_Seg44.MouseHover, Pb_Seg44.Click, Pb_Seg43.MouseHover, Pb_Seg43.Click, Pb_Seg42.MouseHover, Pb_Seg42.Click, Pb_Seg41.MouseHover, Pb_Seg41.Click, Pb_Seg40.MouseHover, Pb_Seg40.Click, Pb_Seg4.MouseHover, Pb_Seg4.Click, Pb_Seg39.MouseHover, Pb_Seg39.Click, Pb_Seg38.MouseHover, Pb_Seg38.Click, Pb_Seg37.MouseHover, Pb_Seg37.Click, Pb_Seg36.MouseHover, Pb_Seg36.Click, Pb_Seg35.MouseHover, Pb_Seg35.Click, Pb_Seg34.MouseHover, Pb_Seg34.Click, Pb_Seg33.MouseHover, Pb_Seg33.Click, Pb_Seg32.MouseHover, Pb_Seg32.Click, Pb_Seg31.MouseHover, Pb_Seg31.Click, Pb_Seg30.MouseHover, Pb_Seg30.Click, Pb_Seg3.MouseHover, Pb_Seg3.Click, Pb_Seg29.MouseHover, Pb_Seg29.Click, Pb_Seg28.MouseHover, Pb_Seg28.Click, Pb_Seg27.MouseHover, Pb_Seg27.Click, Pb_Seg26.MouseHover, Pb_Seg26.Click, Pb_Seg25.MouseHover, Pb_Seg25.Click, Pb_Seg24.MouseHover, Pb_Seg24.Click, Pb_Seg23.MouseHover, Pb_Seg23.Click, Pb_Seg22.MouseHover, Pb_Seg22.Click, Pb_Seg21.MouseHover, Pb_Seg21.Click, Pb_Seg20.MouseHover, Pb_Seg20.Click, Pb_Seg2.MouseHover, Pb_Seg2.Click, Pb_Seg19.MouseHover, Pb_Seg19.Click, Pb_Seg18.MouseHover, Pb_Seg18.Click, Pb_Seg17.MouseHover, Pb_Seg17.Click, Pb_Seg16.MouseHover, Pb_Seg16.Click, Pb_Seg15.MouseHover, Pb_Seg15.Click, Pb_Seg14.MouseHover, Pb_Seg14.Click, Pb_Seg13.MouseHover, Pb_Seg13.Click, Pb_Seg12.MouseHover, Pb_Seg12.Click, Pb_Seg11.MouseHover, Pb_Seg11.Click, Pb_Seg100.MouseHover, Pb_Seg100.Click, Pb_Seg10.MouseHover, Pb_Seg10.Click, Pb_Seg1.Click
Dim Segment As PictureBox = DirectCast(sender, PictureBox)
Segment.BackColor = Color.FromArgb(PatternColorsRed(ColorSelected), PatternColorsGreen(ColorSelected), PatternColorsBlue(ColorSelected))
' ColorSelected = (pb.Tag)
intRed(intStepNumber) = PatternColorsRed(ColorSelected)
intGreen(intStepNumber) = PatternColorsGreen(ColorSelected)
intBlue(intStepNumber) = PatternColorsBlue(ColorSelected)
End Sub