Himanshu

Negi

Developer & Internet Marketer


Welcome to my blog.

Sed sed leo sit amet elit sagittis fermentum. Nulla posuere commodo erat. Nam ac nunc ipsum, id espara tincidunt orci. Quisque adipiscing molestie dolor, ut congue sem porta et. Sed sapien urna, auctor et accumsan ut, accumsan sit amet dui. Nunc tristique interdum magna, dictum volutpat sem. Nam ac nunc ipsum, id espara tincidunt orci. Sed sapien urna, auctor et accumsan ut.

RGB Color Mixing Machine: A Visual Basic Program

May 3, 2017wp-himu0 Comments

A color mixing machine is a visual basic program that will generate different colors on the basis of intensity of three primary colors red, blue and green that we will set.

The RGB color mixing machine is a visual basic program in which red, green, and blue colors are added together in various ways to reproduce a broad array of colors. The name RGB comes from the initials of the three additive primary colors, red, green, and blue.

color mixer machine VB

Steps to Create Color Mixing Machine – VB

  • Open Microsoft Visual basic and select standard.exe project.
  • Using tools from the left toolbar add 4 Text Box, 3 labels and 3 HscrollBar (horizontal scroll bar) as shown in image.
  • To change label or form name just click on it and on the left side of screen under Properties change their Caption. To make Text Box blank, again under properties remove anything written in Text.
  • Now double click on one of the horizontal scroll bar (HscrollBar) to view code. Add the following code.

Visual Basic Program Code

[codesyntax lang=”basic4gl” title=”Visual Basic Program”]

Private Sub HScroll1_Change()

Text2.Text = Val(HScroll1.Value)

Text1.BackColor = RGB(Val(HScroll1.Value), Val(HScroll2.Value), Val(HScroll3.Value))

End Sub

Private Sub HScroll2_Change()

Text3.Text = Val(HScroll2.Value)

Text1.BackColor = RGB(Val(HScroll1.Value), Val(HScroll2.Value), Val(HScroll3.Value))

End Sub

Private Sub HScroll3_Change()

Text4.Text = Val(HScroll3.Value)

Text1.BackColor = RGB(Val(HScroll1.Value), Val(HScroll2.Value), Val(HScroll3.Value))

End Sub

[/codesyntax]

Each function or whenever anyone of the scroll bar is moved the respective change value is shown in respective text box (Text2, Text3 or Text4) and then this value is added with other color values to show new produced color in Text1.

If you have done everything correctly then program will be able to produce different color on the basis of RGB value. Click here to download sample RGB color mixing machine program (4KB).


Leave a Reply
www.edatastyle.com www.introducingsomething.com