绿色风's Blog
专注AutoIT(Au3)
  • 首页
  • 流●年
  • 笔●记
    • 学习随记
    • 源码示例
  • 脚●本
    • UDF(收集)
    • 工作室UDF
    • 工具●教程
    • 教程之GDI
  • 作●品
  • 下●载
  • 情怀ExcelTip
10月192015

音量条频率

作者:绿色风   发布:2015-10-19 11:54 Monday   分类:   阅读:5168次   评论:0条  

QQ截图20151019194247.png

```#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinApi.au3> ;a simple level indicator (of whatever)... ;change it to fit your needs ;by taietel ; I will use values in the range 0-100. ; For other ranges, you have to modify the script accordingly Global $hLblValue ; label to show the values $gui=GUICreate("GUI", 120, 150,-1,-1,$WS_POPUP,$WS_EX_LAYERED) GUISetBkColor(0xabcdef) ;initialize the levelmeter ;example fragmented $a = _CreateLevelMeter(5,5) $b = _CreateLevelMeter(40,5,False,20,5,30,0xFFFFFF,0x0000FF) ;example continuous $c = _CreateLevelMeter(75,5,True,20,5,30,0x00FF00,0xFFFF00) _WinAPI_SetLayeredWindowAttributes($gui,0xabcdef) GUISetState() ;and display some random values For $i=1 To 100 $s1=Random(0,100,1) $s2=Random(0,100,1) $s3=Random(0,100,1) _ShowLevelMeter($a, $s1) _ShowLevelMeter($b, $s2) _ShowLevelMeter($c, $s3) Sleep(100) Next Sleep(2000) Exit While 1 Sleep(10) Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd Func _CreateLevelMeter($iX=5, $iY=5, $bContinous=False, $iUnits=20, $iUnitHeight=5, $iUnitWidth=30, $lStartColour=0xFFFF00, $lEndColour=0xFF0000,$hLblValue="") Local $iUH, $arIndicator[$iUnits], $arColours[$iUnits] Local $arRet[$iUnits][4] If $bContinous = False Then $iUH = $iUnitHeight+1 Else $iUnitHeight+=1 $iUH = $iUnitHeight EndIf ;label to show some values (optional) $hLblValue = GUICtrlCreateLabel("", $iX, $iY+$iUH*$iUnits+$iUH+5, $iUnitWidth, 18,$SS_CENTER) GUICtrlSetColor(-1,0xFF0000) $Ri = Mod($lStartColour,256) $Gi = BitAND($lStartColour/256,255) $Bi = BitAND($lStartColour/65536,255) $Rf = Mod($lEndColour,256) $Gf = BitAND($lEndColour/256,255) $Bf = BitAND($lEndColour/65536,255) $Rs = Abs($Ri - $Rf)/$iUnits $Gs = Abs($Gi - $Gf)/$iUnits $Bs = Abs($Bi - $Bf)/$iUnits If $Rf < $Ri Then $Rs = -$Rs If $Gf < $Gi Then $Gs = -$Gs If $Bf < $Bi Then $Bs = -$Bs For $i=0 To $iUnits-1 $Rf = $Ri + $Rs * $i $Gf = $Gi + $Gs * $i $Bf = $Bi + $Bs * $i $arColours[$i]="0x"&Hex($Bf,2) & Hex($Gf,2) & Hex($Rf,2) Next For $i=0 To $iUnits-1 $arIndicator[$i] = GUICtrlCreateLabel("", $iX, ($iY+$iUH*$iUnits)-$iUH*$i, $iUnitWidth, $iUnitHeight) $arRet[$i][0]=$arIndicator[$i] $arRet[$i][1]=$arColours[$i] $arRet[$i][2]=$iUnits $arRet[$i][3]=$hLblValue Next Return $arRet EndFunc Func _ShowLevelMeter(ByRef $avArray, $Signal,$iMinValue=0,$iMaxValue=100) GUICtrlSetData($avArray[0][3], $Signal) Local $iUnitsColoured Local $m = Mod($Signal, $avArray[0][2]) Switch $m Case 0 $iUnitsColoured=($Signal-$m)*$avArray[0][2]/100 Case Else $iUnitsColoured=($Signal-$m)*$avArray[0][2]/100 + 1 EndSwitch For $i=0 To $iUnitsColoured-1 GUICtrlSetBkColor($avArray[$i][0], $avArray[$i][1]) Next For $j=UBound($avArray)-1 To $iUnitsColoured Step -1 GUICtrlSetBkColor($avArray[$j][0], $GUI_BKCOLOR_TRANSPARENT) Next EndFunc```





本文固定链接: http://www.jianyiit.com/post-144.html

blogger
该日志由 绿色风 于2015-10-19 11:54 Monday发表在 分类下。
版权所有:《绿色风's Blog》 → 《音量条频率》;
除特别标注,本博客很多文章均为原创. 互联分享,尊重版权,转载请以链接形式标明本文地址;
本文标签:

扫描二维码,在手机上阅读
上一篇::笔记本电池电量显示
下一篇:AU3两圆切示例

热门文章

相关文章

  • WMI方式 获取计算机的类型
  • AU3高级目录文件遍历
  • 显示器 EDID 读取,生产日期和分辨率
  • AU3利用shell.application获取图片的所有信息扩展信息
  • 实现对控件inputbox的禁止粘贴
取消回复

发表评论

亲,头像对么?

15 + 90 =

提交中,请稍候……


木有头像就木JJ啦!还木有头像吗?点这里申请属于你的个性Gravatar头像吧!


    站点统计
    • 运行时间: 20254 天
    • 日志总数: 365 篇
    • 评论数量: 7253 条
    • 微语数量: 6 条
    • 附件总量: 388 件
  • 逝出的青春

  • 打赏"绿色风"



      扫码关注本站公众号 可搜本站内容

  • Autoit V3 脚本交流群

      常驻群1:905774875
      常驻群2:40672266


  • 链接

    • AU3中文论坛
    • Excel资料库
    • 完美者博客
    • 顺网小哥'S Blog
    • 猛牛哥的博客
    • 网吧系统下载
  • 分类

    • 流●年(66)
    • 笔●记(0)
    • 脚●本(0)
    • 作品(21)
    • 学习随记(51)
    • 源码示例(68)
    • UDF(收集)(26)
    • 工作室UDF(30)
    • 工具●教程(62)
    • 教程之GDI(24)
Copyright © 2013 绿色风's Blog. Powered by emlog. Theme by 射雕天龙. 鄂ICP备2021011689号-1 鄂公网安备42102302000078号 sitemap