色合成プログラム

プログラム例
'定数の宣言
Dim ccolor1 As Integer
Dim ccolor2 As Integer
Dim ccolor3 As Integer

'終了
Private Sub Command1_Click()
    End
End Sub

'保存
Private Sub Command2_Click()

    SavePicture Picture1.Image, "z:\69918\color.bmp"

End Sub

'フォームのクリア
Private Sub Command3_Click()
    Form1.Cls
End Sub

'フォームロード時の処理
Private Sub Form_Load()
    Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)  '黒
    Picture2.BackColor = RGB(HScroll1.Value, 0, 0)  '黒
    Picture3.BackColor = RGB(0, HScroll2.Value, 0)  '黒
    Picture4.BackColor = RGB(0, 0, HScroll3.Value)  '黒
End Sub

Private Sub HScroll1_Change()

    Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
    Picture2.BackColor = RGB(HScroll1.Value, 0, 0)
   
    Text1.Text = HScroll1

End Sub

Private Sub HScroll2_Change()

    Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
    Picture3.BackColor = RGB(0, HScroll2.Value, 0)
   
    Text2.Text = HScroll2

End Sub

Private Sub HScroll3_Change()

    Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
    Picture4.BackColor = RGB(0, 0, HScroll3.Value)
    
    Text3.Text = HScroll3

End Sub

'落書き
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

   DrawWidth = 5 '線の太さ

   If Button = 1 Then
        PSet (X, Y), RGB(ccolor1, ccolor2, ccolor3)
   End If
   
   
End Sub

'落書きに関するエラー対策
Private Sub Picture1_Click()

    If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
        MsgBox ("そりゃ無理ッス")
    Else
        ccolor1 = Text1
        ccolor2 = Text2
        ccolor3 = Text3
    End If
End Sub