1.http://blog.163.com/y845766643@126/blog/static/171046302201081475351690/
2010-09-1419:53:51|分类:MINIGUI |标签:minigui字体放大、控件字体颜色的问题|举报|字号订阅下载LOFTER我的照片书|昨天有人向我问了两个问题,一个是MiniGUI字体(汉字)放大的问题,第二个是读取文本文件在Minigui上显示的问题。刚刚又向我问了下Minigui中改变控件中的字体颜色的问题?改变字体颜色SetWindowElementColorEx,来改变控件前景色,背景色等。其中,前景色就控件字体颜色。在windows.h中的定义gal_pixelGUIAPISetWindowElementColorEx(HWNDhwnd,Uint16item,gal_pixelnew_value);fgc_control_normal:正常状态的控件前景色.fgc_control_disabled:禁止状态的控件前景色.bkc_hilight_normal:控件选中部分的背景色。例子:SetWindowElementColorEx函数使用可以详见编程手册SetWindowElementColorEx(GetDlgItem(hDlg,IDC_PROMPT_WEA_TEMPCON),FGC_CONTROL_NORMAL,RGB2Pixel(HDC_SCREEN,255,255,255));上面是设为白色SetWindowElementColorEx(hwnd,FGC_CONTROL_NORMAL,fgcolor);Minigui字体放大和用的字体有关,汉字字体不是使用TRUETYPE的字体。,首先要修改minigui.cfg配置文件,在Truetype字体增加对中文支持的字体,默认的3个是支持英文字体放大的,然后创建字体的时候字体类型(type)用ttf类型,并且在修改配置文件的时候要把字体库拷贝到配置文件所指定的目录下,这样基本上可以达到放大字体的效果。以下是我程序里创建逻辑字体的代码//创建一个字体lfSong20CreateLogFont("ttf","song","GB2312",FONT_WEIGHT_REGULAR,FONT_SLANT_ROMAN,FONT_SETWIDTH_NORMAL,FONT_SPACING_CHARCELL,FONT_UNDERLINE_NONE,FONT_STRUCKOUT_NONE,30,0);lfSong32CreateLogFont("ttf","song","GB2312",FONT_WEIGHT_REGULAR,FONT_SLANT_ROMAN,FONT_SETWIDTH_NORMAL,FONT_SPACING_CHARCELL,FONT_UNDERLINE_NONE,FONT_STRUCKOUT_NONE,32,0);下面是CFG文件中关于ttf字体的一段[truetypefonts]font_number4name0ttf-stxinwei-rrncnn-0-0-GB2312fontfile0/usr/local/lib/minigui/res/font/stxinwei.ttfname1ttf-arial-rrncnn-0-0-ISO8859-1fontfile1/usr/local/lib/minigui/res/font/arial.ttfname2ttf-times-rrncnn-0-0-ISO8859-1fontfile2/usr/local/lib/minigui/res/font/times.ttfname3ttf-pinball-rrncnn-0-0-ISO8859-1fontfile3/usr/local/lib/minigui/res/font/pinball.ttf下面是我在主函数中建立逻辑字体的代码lfSong32CreateLogFont("ttf","stxinwei","GB2312",FONT_WEIGHT_REGULAR,FONT_SLANT_ROMAN,FONT_SETWIDTH_NORMAL,FONT_SPACING_CHARCELL,FONT_UNDERLINE_NONE,FONT_STRUCKOUT_NONE,32,0);把字体拷过去,放在了板子根文件系统的usr/local/lib/minigui/res/font/目录下第二个问题是因为那个文本文件里有换行、TAB键、空格等字符,所以你读取的时候那些字符会在Minigui显示出方框,如何把这些方框去掉,向这些字符属于控制字符,读取的去掉这些控制字符就可以了。intiFirst-1,iLast;for(i0;caption[i]!'';i++){printf(caption[i]);if(iscntrl(caption[i])!0){iLasti;if((iLast-iFirst)1){//把这个i的位置记住break;}else{iFirstiLast;}}}增加有关Minigui的几个问题:1、$./helloworld此时提示出错:./helloworld:errorwhileloadingsharedlibraries:libminigui-1.6.so.9:cannotopensharedobjectfile:Nosuchfileordirectory但在/usr/local/minigui/lib中安装了libminigui-1.6.so.9文件。找到/etc下的ld.so.conf文件,加入/usr/local/lib,保存,执行ldconfig2、启动程序时出错:NEWGAL:Setvideomodefailure.GDI:Cannotinitializegraphicsengine!InitGUIfailurewhenusing/usr/local/etc/MiniGUI.cfgascfgfile.Videomodesmallerthanrequested原因:qvfb中的显示设置与MiniGUI.cfg中的显示设置不一样所致,修改成一样就可以了下面列出一些ctype.h里的函数@函数名称:isalpha函数原型:intisalpha(intch);函数功能:检查ch是否是字母.函数返回:1是字母返回,否则返回0.参数说明:所属文件lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;intmain(){charch1'*';charch2'a';if(isalnum(ch1)!0)printf("%cistheASCIInumberoralphebet",ch1);elseprintf("%cisnottheASCIInumbernoralphebet",ch1);if(isalnum(ch2)!0)printf("%cistheASCIInumberoralphebet",ch2);elseprintf("%cisnottheASCIInumbernoralphebet",ch2);return0;}@函数名称:iscntrl函数原型:intiscntrl(intch);函数功能:检查ch是否控制字符(其ASCII码在0和0x1F之间,数值为0-31).函数返回:是返回1,否则返回0.参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;charchars[]{'A',0x09,'Z'};#defineSIZEsizeof(chars)/sizeof(char)intmain(){inti;for(i0;ilt;SIZE;i++){printf("Char%cis%saControlcharacter",chars,(iscntrl(chars))?"":"not");}return0;}@函数名称:isdigit函数原型:intisdigit(intch);函数功能:检查ch是否是数字(0-9)函数返回:是返回1,否则返回0参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;intmain(){charch1'1';charch2'a';if(isdigit(ch1)!0)printf("%cistheASCIInumber",ch1);elseprintf("%cisnottheASCIInumber",ch1);if(isdigit(ch2)!0)printf("%cistheASCIInumber",ch2);elseprintf("%cisnottheASCIInumber",ch2);return0;}@函数名称:isgraph函数原型:intisgraph(intch);函数功能:检查ch是否可显示字符(其ASCII码在ox21到ox7E之间),不包括空格函数返回:是返回1,否则返回0参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;intmain(){charch1'';charch2'a';if(isgraph(ch1)!0)printf("%cistheASCIIprintablecharacter",ch1);elseprintf("%cisnottheASCIIprintablecharacter",ch1);if(isgraph(ch2)!0)printf("%cistheASCIIprintablecharacter",ch2);elseprintf("%cisnottheASCIIprintablecharacter",ch2);return0;}@函数名称:islower函数原型:intislower(intch);函数功能:检查ch是否小写字母(a-z)函数返回:是返回1,否则返回0参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;charchars[]{'A','a','z','Z'};#defineSIZEsizeof(chars)/sizeof(char)intmain(){inti;for(i0;ilt;SIZE;i++){printf("Char%cis%salowercasecharacter",chars,(islower(chars))?"":"not");}return0;}@函数名称:tolower函数原型:inttolower(intch);函数功能:将ch字符转换为小写字母函数返回:返回ch所代表的字符的小写字母参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;stdlib.hgt;#includelt;ctype.hgt;intmain(){charx'a',y'b',z'A',w'*';printf("Character%ctoloweris%c",x,tolower(x));printf("Character%ctoloweris%c",y,tolower(y));printf("Character%ctoloweris%c",z,tolower(z));printf("Character%ctoloweris%c",w,tolower(w));return0;}@函数名称:toupper函数原型:inttoupper(intch);函数功能:将ch字符转换成大写字母函数返回:与ch相应的大写字母参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;stdlib.hgt;#includelt;ctype.hgt;intmain(){charx'a',y'b',z'A',w'*';printf("Character%ctoupperis%c",x,toupper(x));printf("Character%ctoupperis%c",y,toupper(y));printf("Character%ctoupperis%c",z,toupper(z));printf("Character%ctoupperis%c",w,toupper(w));return0;}@函数名称:isalnum函数原型:intisalnum(intch);函数功能:检查ch是否是字母或数字函数返回:是字母或数字返回1,否则返回0参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;intmain(){charch1'*';charch2'a';if(isalnum(ch1)!0)printf("%cistheASCIInumberoralphebet",ch1);elseprintf("%cisnottheASCIInumbernoralphebet",ch1);if(isalnum(ch2)!0)printf("%cistheASCIInumberoralphebet",ch2);elseprintf("%cisnottheASCIInumbernoralphebet",ch2);return0;}@函数名称:isprint函数原型:intisprint(intch);函数功能:检查ch是否是可打印字符(包括空格),其ASCII码在ox20到ox7E之间函数返回:是返回1,否则返回0参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;intmain(){charch1'';charch2'a';if(isprint(ch1)!0)printf("%cistheASCIIprintablecharcater",ch1);elseprintf("%cisnottheASCIIprintablecharcater",ch1);if(isprint(ch2)!0)printf("%cistheASCIIprintablecharcater",ch2);elseprintf("%cisnottheASCIIprintablecharcater",ch2);return0;}@函数名称:ispunct函数原型:intispunct(intch);函数功能:检查ch是否是标点字符(不包括空格),即除字母,数字和空格以外的所有可打印字符函数返回:是返回1,否则返回0参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;intmain(){charch1',';charch2'a';if(ispunct(ch1)!0)printf("%cistheASCIIpunct",ch1);elseprintf("%cisnottheASCIIpunct",ch1);if(ispunct(ch2)!0)printf("%cistheASCIIpunct",ch2);elseprintf("%cisnottheASCIIpunct",ch2);return0;}@函数名称:isspace函数原型:intisspace(intch);函数功能:检查ch是否是空格符和跳格符(控制字符)或换行符函数返回:是返回1,否则返回0参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;intmain(){charch1'';charch2'a';if(isspace(ch1)!0)printf("%cisthespacecharcater",ch1);elseprintf("%cisnotthespacecharcater",ch1);if(isspace(ch2)!0)printf("%cisthespacecharcater",ch2);elseprintf("%cisnotthespacecharcater",ch2);return0;}@函数名称:isupper函数原型:intisupper(intch);函数功能:检查ch是否是大写字母(A-Z)函数返回:是返回1,否则返回0参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;charchars[]{'A','a','z','Z'};#defineSIZEsizeof(chars)/sizeof(char)intmain(){inti;for(i0;ilt;SIZE;i++){printf("Char%cis%sanuppercasecharacter",chars,(isupper(chars))?"":"not");}return0;}@函数名称:isxdigit函数原型:intisxdigit(intch);函数功能:检查ch是否是一个16进制数学字符(即0-9,或A-F,或a-f)函数返回:是返回1,否则返回0参数说明:所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;intmain(){charch1'1';charch2'a';if(isxdigit(ch1)!0)printf("%cistheASCIIhexadecimalnumber",ch1);elseprintf("%cisnottheASCIIhexadecimalnumber",ch1);if(isxdigit(ch2)!0)printf("%cistheASCIIhexadecimalnumber",ch2);elseprintf("%cisnottheASCIIhexadecimalnumber",ch2);return0;}@函数名称:isascii函数原型:intisascii(intch)函数功能:测试参数是否是ASCII码0-127函数返回:非零-是,0-不是参数说明:ch-被测参数所属文件:lt;ctype.hgt;#includelt;stdio.hgt;#includelt;ctype.hgt;charchars[]{'A',0x80,'Z'};#defineSIZEsizeof(chars)/sizeof(char)intmain(){inti;for(i0;ilt;SIZE;i++){printf("Char%cis%sanASCIIcharacter",chars,(isascii(chars))?"":"not");}return0;}
MiniGUI字体放大控件字体颜色的问题转-英文mini小字体-微信小程序用什么字体
浏览量:2025
时间:
来源:mengzhengjie
版权声明
即速应用倡导尊重与保护知识产权。如发现本站文章存在版权问题,烦请提供版权疑问、身份证明、版权证明、联系方式等发邮件至197452366@qq.com ,我们将及时处理。本站文章仅作分享交流用途,作者观点不等同于即速应用观点。用户与作者的任何交易与本站无关,请知悉。

最新资讯
-
抖音再现本地生活服务,咫尺同城圈商业变现新通道
短视频成为本地生活探店网红营销变现引流的新阵地,每一位网红都渴望在短视频内“一夜爆红”。即速应用团队对多商家小程序进行升级,打造了咫尺同城圈:“同城探店营销助手”,不仅完善商家营销技巧,还助力探店网红玩转本地生活服务。 -
抖音再现本地生活服务,咫尺同城圈商业变现新通道
短视频成为本地生活探店网红营销变现引流的新阵地,每一位网红都渴望在短视频内“一夜爆红”。即速应用团队对多商家小程序进行升级,打造了咫尺同城圈:“同城探店营销助手”,不仅完善商家营销技巧,还助力探店网红玩转本地生活服务。 -
阿坝小程序代理
阿坝藏族羌族小程序代理公司有哪些?阿坝藏族羌族小程序代理平台哪个好?阿坝藏族羌族小程序代理商怎么收费,代理政策如何?下面就让即速应用产品经理jisuapp.cn来告诉你吧!