none
create Graphic frequency Equalizer

    Question

  • Dear friend,

    i am using vb.net2005 express edition
    is this possible to create Graphic frequency Equalizer in vb.net.becos i am doing vibration monitoring system project.so i need to create Graphic frequency Equalizer .so i have to build scrolable control to increase and decrese the frequency values using the contol..is this possible to create in vb.net if means please show me if there is any link or example for this please

    Tuesday, February 19, 2008 5:33 PM

Answers

All replies

  • Hi B2A,

    Use TrackBar rather than a scrollbar. You could have a row of track bars each oriented vertically, set min and max values and set the tick mark spacing and tick style. Then attach the scroll event to get its value to send to the vibration rig controller.

    Code Snippet
    1. Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
    2.     TextBox1.Text = TrackBar1.Value
    3. End Sub
    • Proposed as answer by Tim Mathias Wednesday, October 14, 2009 7:52 PM
    • Edited by Tim Mathias Thursday, October 15, 2009 3:14 PM Reformatted code snippet.
    Wednesday, February 20, 2008 11:20 AM
  • Dear friend,

     Actually i need to fill red color inside VScrollbar.is it possible to use. becos  while scrolling  the intensity of the redcolor has to change .but i have use one control for both(scrolling and filling color inside the scrollbar). please help me to achieve this please
    Wednesday, February 20, 2008 2:48 PM
  • Try these:

    System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar

    System.Windows.Forms.TrackBarRenderer

    System.Windows.Forms.TrackBarRenderer.DrawVerticalTrack(ByVal System.Drawing.Graphics, ByVal System.Drawing.Rectangle)

    Or set the BackColor:

    Code Snippet
    1. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    2.     TrackBar1.BackColor = Color.FromArgb(TrackBar1.Value / TrackBar1.Maximum * 255, 0, 0)
    3. End Sub
    4.  
    5. Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
    6.     TextBox1.Text = TrackBar1.Value
    7.     TrackBar1.BackColor = Color.FromArgb(TrackBar1.Value / TrackBar1.Maximum * 255, 0, 0)
    8. End Sub
    • Proposed as answer by Tim Mathias Wednesday, October 14, 2009 7:52 PM
    • Edited by Tim Mathias Thursday, October 15, 2009 3:01 PM Reformatted code snippet.
    Wednesday, February 20, 2008 3:24 PM
  • Dear Friend,
    thanks a lot for your  genius  reply.i run your code. but it shows redcolor.is it possible to bring all the colors in back of trackbar?  so depends  the color intesity change. is this possible?if means please let me know the way.pls show some sample code please
    Wednesday, February 20, 2008 5:25 PM
  • You initially said you wanted to change the redcolor, but now you want the other colors back in. I'm not sure what that means. There are an infinite number of colour variations. It's up to you to fine tune exactly how you want it to look. So moving from the realm of genius code to genius art, here's few suggestions:

    Code Snippet
    1. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    2.     TrackBar1SetBackColor()
    3. End Sub
    4.  
    5. Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
    6.     TextBox1.Text = TrackBar1.Value
    7.     TrackBar1SetBackColor()
    8. End Sub
    9.  
    10. Private Sub TrackBar1SetBackColor()
    11.     'TrackBar1.BackColor = Color.FromArgb(TrackBar1.Value / TrackBar1.Maximum * 255, 0, 0)
    12.     'TrackBar1.BackColor = Color.FromArgb(TrackBar1.Value / TrackBar1.Maximum * 127 + 128, 0, 0)
    13.     'TrackBar1.BackColor = Color.FromArgb(TrackBar1.Value / TrackBar1.Maximum * 127 + 128, 128, 128)
    14.     'TrackBar1.BackColor = Color.FromArgb(255, 255 - TrackBar1.Value / TrackBar1.Maximum * 255, 255 - TrackBar1.Value / TrackBar1.Maximum * 255)
    15.     TrackBar1.BackColor = Color.FromArgb(SystemColors.Control.R, SystemColors.Control.G - TrackBar1.Value / TrackBar1.Maximum * SystemColors.Control.G, SystemColors.Control.B - TrackBar1.Value / TrackBar1.Maximum * SystemColors.Control.B)
    16. End Sub

    The colours are a combination of Alpha (opacity), Red, Green and Blue. It's like an artist's pallette. It's up to you how you mix them.

    • Proposed as answer by Tim Mathias Wednesday, October 14, 2009 7:52 PM
    • Edited by Tim Mathias Thursday, October 15, 2009 3:05 PM Reformatted code snippet.
    Wednesday, February 20, 2008 6:34 PM
  • Here's another suggestion:

    Code Snippet
    1. TrackBar1.BackColor = Color.FromArgb(TrackBar1.Value / TrackBar1.Maximum * (255 - SystemColors.Control.R) + SystemColors.Control.R, SystemColors.Control.G - TrackBar1.Value / TrackBar1.Maximum * SystemColors.Control.G, SystemColors.Control.B - TrackBar1.Value / TrackBar1.Maximum * SystemColors.Control.B)
    2. Debug.Print(TrackBar1.BackColor.ToString())

    Run it in debug mode (F5) to see the list of colours in the Intermediate Window (Ctrl+G).

    • Proposed as answer by Tim Mathias Wednesday, October 14, 2009 7:52 PM
    • Edited by Tim Mathias Thursday, October 15, 2009 3:09 PM Reformatted code snippet.
    Wednesday, February 20, 2008 6:47 PM
  • Thursday, February 21, 2008 9:46 AM