当前位置: 首页 > news >正文

学做彩票网站惠州seo代理计费

学做彩票网站,惠州seo代理计费,怎么办理网站地址,国外网站建设公司写在前面 这是PB案例学习笔记系列文章的第22篇,该系列文章适合具有一定PB基础的读者。 通过一个个由浅入深的编程实战案例学习,提高编程技巧,以保证小伙伴们能应付公司的各种开发需求。 文章中设计到的源码,小凡都上传到了gite…

写在前面

这是PB案例学习笔记系列文章的第22篇,该系列文章适合具有一定PB基础的读者。

通过一个个由浅入深的编程实战案例学习,提高编程技巧,以保证小伙伴们能应付公司的各种开发需求。

文章中设计到的源码,小凡都上传到了gitee代码仓库https://gitee.com/xiezhr/pb-project-example.git

gitee代码仓库

需要源代码的小伙伴们可以自行下载查看,后续文章涉及到的案例代码也都会提交到这个仓库【pb-project-example

如果对小伙伴有所帮助,希望能给一个小星星⭐支持一下小凡。

一、小目标

上一个案例中我们将小写金额转换为大写金额,这一个案例中我们将制作一个语音播报金额的小应用。

这个在日常开发中也很常见,尤其是在收费结算应用中。最终实现效果如下

金额语音播报

二、实现思路

首先我们需要准备 零、壹、贰、叁、肆、伍、陆、柒、捌、玖、拾、佰、仟、万、亿、元、角、分、整

的.wav格式的语音文件。然后通过WINMM.dll外部动态库的sandPlaySoundA()和waveOutGetNumDevs()

联合起来播放语音文件

三、创建程序基本框架

① 新建examplework工作区

② 新建exampleapp应用

③ 新建w_main窗口,将其Title属性值设置成“朗读款项金额”

由于篇幅原因,以上步骤这儿就不展开了,忘记了的小伙伴翻一翻该系列文章的第一篇

④ 在w_main窗口上放置控件

在窗口上添加3个StaticEdit控件,1个singleLineEdit控件和2个CommandButton。将其分别命名为st_1st_2st_3

sle_1sle_2cb_1cb_2。 调整各个控件布局后如下

控件布局

⑤ 保存窗口

四、编写代码

① 定义本地外部扩展函数

w_mainDeclare Local External Function 选项卡中添加如下代码

Function boolean sndPlaySoundA(string SoundName, uint Flags) Library "WINMM.DLL"
Function uint waveOutGetNumDevs ()Library "WINMM.DLL"

定义扩展函数

② 在W_main窗口的Function List 选项卡中添加Playsound(string as_filename,integer ai_option) return integer函数

代码如下

uint lui_numdevslui_numdevs = WaveOutGetNumDevs() 
If lui_numdevs > 0 Then sndPlaySoundA(as_filename,ai_option)return 1
Elsereturn -1
End If

③ 在w_main窗口的Function List 选项卡中添加xx2dx(decimal ls) return string函数

代码如下

string dx_sz,dx_dw,str_int,str_dec,dx_str,fu,a,b,b2,c,d,result
long num_int,num_dec,len_int,i,a_int,ppdx_sz = "零壹贰叁肆伍陆柒捌玖" 
dx_dw = "万仟佰拾亿仟佰拾万仟佰拾元" //处理小于零情况
if ls<0 thenls = ls*(-1) fu = "负" 
else fu = "" 
end if //取得整数及整数串
dx_str = string(ls)
if (ls>0) and (ls<1) then dx_str = "0"+dx_str 
pp = pos(dx_str,".") 
if pp>0 then str_int = mid(dx_str,1,pos(dx_str,".")-1)
elsestr_int = dx_str 
end if 
num_int = long(str_int) //取得小数及小数串
if (ls>0) and (ls<1) then num_dec = ls * 100
elsenum_dec = (ls - num_int) * 100 
end if 
str_dec = string(num_dec) 
len_int = len(str_int) 
dx_str = "" //转换整整部分
for i = 1 to len_int //a为小写数字字符,b为对应的大写字符,c为对应大写单位,d为当前大写字符串的最后一个汉字a= mid(str_int,i,1) a_int = long(a) b = mid(dx_sz,(a_int*2)+1,2) c = mid(dx_dw,((13 - len_int +i - 1)*2+1),2) if dx_str<>"" thend=mid(dx_str,len(dx_str)-1,2)elsed= "" end if if (b="零") and ((d="零") or (b=b2) or (c="元") or (c="万") or (c="亿")) then  b = "" if (a="0") and (c<>"元") and (c<>"万") and (c<>"亿") then c="" if ((c="元") or (c="万") or (c="亿")) and (d="零") and (a="0") thendx_str = mid(dx_str,1,len(dx_str)-2) d=mid(dx_str,len(dx_str)-1,2) if ((c="元") and (d="万")) or ((c="万") and (d="亿")) then c = "" end if dx_str = dx_str + b+ c b2 = b 
next//处理金额小于1的情况if len(dx_str) <= 2 then dx_str= "" //转换小数部分if (num_dec<10) and (ls>0) thena_int = long(str_dec) b = mid(dx_sz,(a_int*2+1),2) if num_dec = 0 then dx_str = dx_str + "整" if num_dec > 0 then dx_str = dx_str +"零"+b+"分" end ifif num_dec >= 10 thena_int = long(mid(str_dec,1,1)) a = mid(dx_sz,(a_int*2+1),2) a_int = long(mid(str_dec,2,1)) b = mid(dx_sz,(a_int*2+1),2) if a<>"零" then a = a+"角" if b <> "零" thenb = b+"分"else b= "" end ifdx_str = dx_str + a + b end ifif ls= 0 then dx_str = "零元整" dx_str = fu+dx_str result = dx_str return result

④ 将事先准备好的.wav格式声音放到项目temp目录下

事下准备好的声音

语音包小凡已经上传的百度网盘了,需要的小伙伴自行下载哈

链接:https://pan.baidu.com/s/17sPGYC21fvzw4ebgXll74A?pwd=8888
提取码:8888

⑤在w_main窗口的cb_1按钮的Clicked事件 中添加如下代码

integer i,count
string ls_current_path
//获取项目当前路径
ls_current_path = GetCurrentDirectory()st_3.text = xx2dx(dec(sle_1.text))count = len(st_3.text)for i= 1 to count step 2CHOOSE CASE mid(st_3.text,i,2)CASE "零"playsound(ls_current_path+"\temp\0.wav",0)				CASE "壹"playsound(ls_current_path+"\temp\1.wav",0)				CASE "贰"playsound(ls_current_path+"\temp\2.wav",0)				CASE "叁"playsound(ls_current_path+"\temp\3.wav",0)				CASE "肆"playsound(ls_current_path+"\temp\4.wav",0)				CASE "伍"playsound(ls_current_path+"\temp\5.wav",0)				CASE "陆"playsound(ls_current_path+"\temp\6.wav",0)				CASE "柒"playsound(ls_current_path+"\temp\7.wav",0)				CASE "捌"playsound(ls_current_path+"\temp\8.wav",0)				CASE "玖"playsound(ls_current_path+"\temp\9.wav",0)				CASE "拾"playsound(ls_current_path+"\temp\十.wav",0)				CASE "佰"playsound(ls_current_path+"\temp\佰.wav",0)				CASE "仟"playsound(ls_current_path+"\temp\仟.wav",0)				CASE "万"playsound(ls_current_path+"\temp\万.wav",0)				CASE "亿"playsound(ls_current_path+"\temp\亿.wav",0)				CASE "元"playsound(ls_current_path+"\temp\元.wav",0)				CASE "角"playsound(ls_current_path+"\temp\角.wav",0)				CASE "分"playsound(ls_current_path+"\temp\分.wav",0)				CASE "整"playsound(ls_current_path+"\temp\整.wav",0)				END CHOOSE
next

⑥ 在cb_2退出按钮的Clicked事件中添加如下代码

close(parent)

⑦ 在开发界面左边的System Tree窗口中双击exampleapp应用对象,并在其Open事件中添加如下代码

open(w_main)

五、运行程序

代码写完了,来检验下我们的劳动成果。

金额语音播报

本期内容到这儿就结束了 ,★,°:.☆( ̄▽ ̄)/$:.°★ 。希望对您有所帮助

我们下期再见 ヾ(•ω•`)o (●’◡’●)

http://www.tj-hxxt.cn/news/25154.html

相关文章:

  • 公司网站要怎么做网站推广是干嘛的
  • 产品设计网站制作免费搭建个人网站
  • 网站页面怎么做谷歌seo网站推广怎么做
  • 做网站包括什么条件互联网广告推广是什么
  • 做网站 前途数据分析软件
  • 公司网站建设的现状在线培训平台
  • 我想自己建个网站买货 怎么做seo公司官网
  • 如何做财经网站怎么创建网站的快捷方式
  • 可以做宣传的网站有哪些服务推广软文
  • 所以免费爱做网站关键词优化seo费用
  • 基于wordpress的网站推广策略都有哪些
  • 重庆做木门网站公司简介南宁seo全网营销
  • 本地顺德网站建设线上推广app
  • 网站制作技巧进入百度app查看
  • 中国有什么网站做跨境零售新闻播报最新
  • 那个网站做问卷好超级搜索引擎
  • 做网站的公司济南赛博科技市场百色seo外包
  • 政府网站建设与对策分析关键词推广优化排名品牌
  • 新闻网站的设计与制作百度免费广告发布平台
  • 江岸区网站公司百度客户服务中心
  • 网站无法访问的原因免费seo快速收录工具
  • 搜狗做网站怎么样宁波seo外包快速推广
  • 免费卡盟网站建设百度地图关键词优化
  • 江苏天宇建设集团有限公司网站网页制作软件哪个好
  • 主题网站界面设计优化一下
  • 怎样才能在网上卖东西seo推广教程
  • PS做网站报价2022最近十大的新闻热点
  • wordpress萧涵主题成都网站seo服务
  • 福建泉州曾明军的网站外包项目接单平台
  • 哈尔滨多语言网站建设免费网站推广群发软件