如何使用进度条增加窗口媒体播放器的音量 [英] how to use progress bar for increasing volume for window media player
本文介绍了如何使用进度条增加窗口媒体播放器的音量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用vb.net制作媒体播放器软件
我已使用进度条来增加或减少音量.我无法为其编写确切的代码.
我希望当我单击进度条时,音量应该增加还是减少取决于用户要求,就像我们在vlc或window media player之类的媒体播放器中看到的那样.
我尝试了以下代码
I am making a media player software using vb.net
I have taken a progress bar to increase or decrease a volume.I am not not able to write exact code for it.
I want that when I click progress bar volume should increse or decrease depends upon user requirements as we see in media player like vlc or window media player.
i tried following code
Private Sub ProgressBar1_Click_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
ProgressBar1.PerformStep()
wmp.settings.volume = ProgressBar1.Value
If ProgressBar1.Value = 100 Then
ProgressBar1.Value = 40
End If
End Sub
请就此
推荐答案
为我提供帮助,为什么不使用TrackBar
控件呢?使用进度条,您无法将音量调低*.
Why don''t you the a TrackBar
control instead? With a progress bar, you have no way to turn the volume *down*.
这是按照约翰的建议对后续问题的解答:
处理事件System.Windows.Forms.TrackBar.ValueChanged
(不单击);使用传递给事件句柄的event arguments参数访问发送方并读取其int
属性System.Windows.Forms.TrackBar.Value
的值;假设它已分配给变量value
.在此事件处理程序的主体中分配:wmp.settings.volume = value
.
请参阅: http://msdn.microsoft.com/en-us/library/system.windows.forms.trackbar.aspx [ ^ ].
—SA
This is the answer to a follow-up question following the advice by John:
Handle the eventSystem.Windows.Forms.TrackBar.ValueChanged
(not Click); use the event arguments parameter passed to your event handle to access the sender and read the value of itsint
propertySystem.Windows.Forms.TrackBar.Value
; let''s say it''s assigned to the variablevalue
. Assign:wmp.settings.volume = value
, in the body of this event handler.
See: http://msdn.microsoft.com/en-us/library/system.windows.forms.trackbar.aspx[^].
—SA
这篇关于如何使用进度条增加窗口媒体播放器的音量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文