none
How can i make a random colored pixel in a panel react by music in vb RRS feed

  • Question

  • i have find this example to generate a random color here on the forum

    This is the code

    Imports System
    Imports System.Collections.Generic
    Imports System.Linq
    Imports System.Text
    Imports System.Threading.Tasks
    
    Public Class Form1
        Dim ColorNames As New List(Of String)
    
        Dim ColorName As System.Type = GetType(System.Drawing.Color)
        Dim ColorPropInfo As System.Reflection.PropertyInfo() = ColorName.GetProperties()
    
        Dim Rand As New Random
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            
            Me.CenterToScreen()
            For Each CPI As System.Reflection.PropertyInfo In ColorPropInfo
                If CPI.PropertyType.Name = "Color" And CPI.Name <> "Transparent" Then
                    ColorNames.Add(CPI.Name)
                End If
            Next
        End Sub
    
        
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Me.BackColor = Color.FromName(ColorNames(Rand.Next(0, ColorNames.Count)))
        End Sub
    
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            Me.BackColor = Color.FromArgb(Rand.Next(0, 256), Rand.Next(0, 256), Rand.Next(0, 256))
        End Sub
    End Class

    How can i generate a color react with music mp3

    Wednesday, January 2, 2019 9:21 PM

Answers

  • Hi,

    Do you want the background color to follow the music spectrum change?

    https://www.codeproject.com/Articles/20025/Sound-visualizer-in-C

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by helder227 Thursday, January 3, 2019 3:07 AM
    Thursday, January 3, 2019 1:49 AM

All replies

  • Hi

    Posting some copied code doesn't work. You need to post your own code - or what you have done so far, along with issues or problems and question(s).

    You may not have enough experience for that particular request, as you are actually asking for a full blown media player with visual effects.

    Just daying a pixel moving in a panel is easy to do, but involving the playing and sync of sounds is NOT easy.


    Regards Les, Livingston, Scotland

    Wednesday, January 2, 2019 11:49 PM
  • Hi,

    Do you want the background color to follow the music spectrum change?

    https://www.codeproject.com/Articles/20025/Sound-visualizer-in-C

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by helder227 Thursday, January 3, 2019 3:07 AM
    Thursday, January 3, 2019 1:49 AM