-1

I am new and know little about this. I am using WMPLib namespace.

I tried figuring out how to change the volume by using the mouse wheel:

void Form1_MouseWheel(object sender, MouseEventArgs e)
{
    wmpPlayer.settings.volume = //inc or dec
}

How do I do this?

newbieguy
  • 608
  • 1
  • 10
  • 28

3 Answers3

1

Thanks for the answers...

I finally got it:

    void Form1_MouseWheel(object sender, MouseEventArgs e)
    {
        if(e.Delta > 0)
            wmpPlayer.settings.volume = activeMusic.settings.volume + 1;
        else
            wmpPlayer.settings.volume = activeMusic.settings.volume - 1;

        //to check the volume no.
        MessageBox.Show(Convert.ToString(wmpPlayer.settings.volume));
    }
newbieguy
  • 608
  • 1
  • 10
  • 28
0

Why don't you simple use a wmpPlayer.settings.volume++ to achieve this ? You would just have to find a way to check if it's a scrolldown or scrollup !


Check out this post, it might be helping : Using WMP control, volume changes main app volume

Community
  • 1
  • 1
Alexandre Beaudet
  • 2,208
  • 1
  • 16
  • 28
0

A property can have a get or set method to it !

wmpPlayer.settings.volume= wmpPlayer.settings.volume + myValue;

So you first get the current volume value and add to it your value which could be positive or negative depending upon scroll up/down and finally you set it as the final volume

Rahul Jha
  • 1,091
  • 1
  • 10
  • 21
  • @cromix That would depend upon wheel rotation by user : Read [this](https://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousewheel(v=vs.110).aspx) ! Panel_MouseWheel();//Modify this in the code – Rahul Jha Oct 08 '15 at 11:41