如何通过增加其他价值来减少价值

编程入门 行业动态 更新时间:2024-10-08 00:27:36
本文介绍了如何通过增加其他价值来减少价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

好吧,所以,我为某些媒体播放器创建了自定义控制音量,因为静音是-10000,而完整声音是0,我搜遍谷歌并且我找不到任何东西,所以,我如何减少 - 当我将值增加到100时,10000到0. 我尝试过: 我创建了两个属性:

公共 属性 SetVolume() As 整数 获取 返回 _SetVolume 结束 获取 设置(val As 整数) _SetVolume = val 刷新() 结束 设置 结束 属性 公共 属性 Volume() As 整数 获取 返回 _VolumeBar.Volume 结束 获取 设置(Val As 整数) _VolumeBar .Volume = Val Invalidate() 结束 设置 结束 属性

i尝试减少SetVolume增加音量。 MediaPlayerVolume1.SetVolume = MediaPlayerVolume1.Volume TxtVolume.Text = Trim(-10000 * MediaPlayerVolume1.SetVolume / 100 )

我使用TxtVolume.Text进行测试,检查是否有效。

解决方案

获得0到100的读数,乘以-100。

0 - > 0 1 - > -100 ... 100 - > -10000

如果你需要它反转,那么得到你的0到100读数,乘以100并从10000减去它:

0 - > -10000 1 - > -9900 ... 100 - > 0

哦,你去了,谢谢你们的数学解决方案,@ Richard MacCutchan我尝试了你的解决方案,我做的是设置进度条最大值为10000,它看起来像这样:

MediaPlayerVolume1.SetVolume = MediaPlayerVolume1.Volume TxtVolume.Text = Trim(-10000 +( 100 * 100 ) - 10000 + MediaPlayerVolume1.SetVolume)

随着你的数学工作,我想要你的大脑哥们:) 非常感谢你帮助我。

Ok, so, i created custom control volume for some media player, for silent sound is -10000 and for full sound is 0, i searched all over google and i din't found anything, so, how do i decrease -10000 to 0 when i increase value to 100. What I have tried: I created two properties:

Public Property SetVolume() As Integer Get Return _SetVolume End Get Set(val As Integer) _SetVolume = val Refresh() End Set End Property Public Property Volume() As Integer Get Return _VolumeBar.Volume End Get Set(Val As Integer) _VolumeBar.Volume = Val Invalidate() End Set End Property

i tried to decrease SetVolume when i increase Volume.

MediaPlayerVolume1.SetVolume = MediaPlayerVolume1.Volume TxtVolume.Text = Trim(-10000 * MediaPlayerVolume1.SetVolume / 100)

I use "TxtVolume.Text" just for testing, to check if is working or not.

解决方案

Get your 0 to 100 reading, multiply it by -100.

0 -> 0 1 -> -100 ... 100 -> -10000

If you need it reversed, then get your 0 to 100 reading, multiply it by 100 and subtract it from 10000:

0 -> -10000 1 -> -9900 ... 100 -> 0

Oh there ya go, thank you guys for that math solutions, @Richard MacCutchan i tried your solution, what i do is set progressbar Maximum to 10000, it looks like this:

MediaPlayerVolume1.SetVolume = MediaPlayerVolume1.Volume TxtVolume.Text = Trim(-10000 + (100 * 100) - 10000 + MediaPlayerVolume1.SetVolume)

With your math is working, i want your brain dude :) Thank you guys so much for helping me.

更多推荐

如何通过增加其他价值来减少价值

本文发布于:2023-11-30 15:35:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650527.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:价值

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!