📄 一个简单minigui软键盘(非常具有参考意义).htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0052)http://blog.sina.com.cn/s/blog_3e1311d1010009nw.html -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>一个简单MINIGUI软键盘_潇楚一生_新浪博客</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META http-equiv=X-UA-Compatible content=IE=EmulateIE7>
<SCRIPT>
var scope = {
$uid : "1041437137",
$PRODUCT_NAME : "blog",
$pageid : "article",
$key : "c3899562bd2271ad3b0e47b44eed62ed",
$sort_id : "117",
$loadconf : true,
$flag2008 : "0",
$articleid : "3e1311d1010009nw" ,
$isCommentAllow : "1"
};
var $encrypt_code = "a58bb8307e1bb650212594598983d90c";
var config = {"common":{"t":"3_9","r":0,"head":[],"bg":[],"pageset":0,"invitationset":0},"private":{"cms":0,"blogsize":0,"ad":0,"sms":0},"component":{"c1":[901,9,17,12],"c2":[],"x":2},"product":{"c":19,"j":13}};
var fav = {"3e1311d1010009nw":"c7ad104f5627555b566d83e7124e469d"} ;
</SCRIPT>
<SCRIPT src="一个简单MINIGUI软键盘(非常具有参考意义).files/boot.js"
type=text/javascript></SCRIPT>
<SCRIPT type=text/javascript>loadCss();</SCRIPT>
<SCRIPT
src="一个简单MINIGUI软键盘(非常具有参考意义).files/platform_tray.compressed.js"></SCRIPT>
<LINK href="一个简单MINIGUI软键盘(非常具有参考意义).files/im.css" type=text/css rel=stylesheet><!--# block name="blk737369" --><!--# endblock --><!--#include file="/hits?act=4&aid=${aid}" stub="blk737369" -->
<META content="MSHTML 6.00.2900.5512" name=GENERATOR></HEAD>
<BODY>
<DIV id=sinatopbar>
<SCRIPT type=text/javascript>
<!--
document.write(SinaSysTray.getHTML());
//-->
</SCRIPT>
</DIV>
<SCRIPT type=text/javascript>
<!--
SinaSysTray.base_init({
"type" : scope.$PRODUCT_NAME || "",
"uid" : $UID || "0"
});
//-->
</SCRIPT>
<DIV class=wrapper>
<DIV class=headpic100 id=headpic100>
<DIV class=headpic950 id=headPic950>
<DIV class=ntoptitle id=ntoptitle>
<DIV class=ntopns id=blogTitle>
<DIV class=ntitname id=blogname><A
href="http://blog.sina.com.cn/xujirun">潇楚一生的BLOG</A> </DIV>
<DIV class=ntitsite>http://blog.sina.com.cn/xujirun<A class=CP_a_fuc
id=SubscribeNewRss onclick="return false;"
href="http://blog.sina.com.cn/s/blog_3e1311d1010009nw.html#">[<CITE>订阅</CITE>]</A></DIV></DIV></DIV></DIV>
<DIV class=termenubg></DIV>
<DIV class=termenu>
<DIV class=termenuc id=clone_template>
<DIV class=termenutag>
<DIV class=user>
<DIV class=userhead><A href="http://blog.sina.com.cn/xujirun"><IMG
src="一个简单MINIGUI软键盘(非常具有参考意义).files/50.jpg"></A></DIV>
<DIV class=username><A style="CURSOR: hand"
href="http://blog.sina.com.cn/xujirun"><SPAN id=nav_name></SPAN></A></DIV></DIV>
<DIV class=promenu>
<LI class=on><SPAN id=nav_blog><A
href="http://blog.sina.com.cn/xujirun">博客</A></SPAN>
<LI><SPAN id=nav_photo><A
href="http://photo.blog.sina.com.cn/xujirun">相册</A></SPAN>
<LI><SPAN id=nav_music><A
href="http://music.sina.com.cn/m/1041437137">音乐</A></SPAN>
<LI><SPAN id=nav_vblog><A
href="http://you.video.sina.com.cn/xujirun">播客</A></SPAN>
<LI><SPAN id=nav_tiezi><A
href="http://profile.blog.sina.com.cn/xujirun">个人中心</A></SPAN> <!-- <li><span id="nav_quanzi"><a href="http://q.sina.com.cn/m/xujirun">圈子</a></span></li>--></LI></DIV></DIV>
<DIV class=termenutxt>
<DIV class=tmtcen>
<DIV class=floatLeft><SPAN><A
href="http://blog.sina.com.cn/xujirun">首页</A></SPAN><SPAN
class=linesp></SPAN><SPAN><A
href="http://blog.sina.com.cn/s/articlelist_1041437137_0_1.html">博文</A></SPAN><SPAN
class=linesp></SPAN><SPAN><A
href="http://blog.sina.com.cn/s/favourites_1041437137_1.html">收藏</A></SPAN><SPAN
class=linesp></SPAN><SPAN><A
href="http://profile.blog.sina.com.cn/circle.php?uid=1041437137&page=1&type=3">博客圈</A></SPAN><!--<span > <a href="http://blog.sina.com.cn/lm/rank/index.html" target="_blank">排行榜</a></span>--></DIV>
<DIV class=floatRight></DIV></DIV></DIV></DIV></DIV></DIV>
<DIV class=contentLayout>
<DIV class="column_2 floatLeft">
<DIV class="components730 SinaAd_hide" id=advertise_top></DIV>
<DIV class=components730>
<DIV class=component>
<DIV class=componentBar><SPAN class="floatRight articleFontSize"
id=articleFontManage>字体大小:<A onclick="changeFontSize(2);return false;"
href="http://blog.sina.com.cn/s/">大</A><B>中</B><A
onclick="changeFontSize(0);return false;"
href="http://blog.sina.com.cn/s/">小</A></SPAN> <SPAN class=title>正文</SPAN>
</DIV>
<DIV class="componentContent article">
<DIV class=comconblog>
<DIV class=articleTitle>
<DIV style="DISPLAY: inline"><B id=t_3e1311d1010009nw>一个简单MINIGUI软键盘</B><SPAN
class=time>(2007-07-02 10:02:43)</SPAN></DIV></DIV>
<DIV class=articleTag>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD>
<SCRIPT>var $tag='minigui,软键盘';var $tag_code='635e04136ed054d2d5cbcd9a3e3435c8';</SCRIPT>
标签:<A class=tag
href="http://uni.sina.com.cn/c.php?t=blog&k=minigui&ts=bpost&stype=tag"
target=_blank>minigui</A><WBR> <A class=tag
href="http://uni.sina.com.cn/c.php?t=blog&k=%C8%ED%BC%FC%C5%CC&ts=bpost&stype=tag"
target=_blank>软键盘</A><WBR> </TD>
<TD vAlign=top align=right width=250></TD></TR></TBODY></TABLE></DIV>
<DIV class=articleContent id=articleBody>
<DIV><A href="file:///C:/Documents%20and%20Settings/user/ÃÃÃæ/111.bmp"
target=_blank></A><A
href="http://photo.blog.sina.com.cn/showpic.html#blogid=3e1311d1010009nw&url=http://static3.photo.sina.com.cn/orignal/3e1311d1ba87a48a4a332"
target=_blank></A> <WBR> <WBR> <WBR> <WBR> <WBR>这是一个基于minigui,根据项目需要自己写的简单的软键盘,包含了数字、英文字母和点号,点击在编辑框获取值,在鼠标按下时按键变成蓝色,放开则恢复,界面不是很漂亮,效果图片如下:</DIV>
<DIV><A href="file:///C:/Documents%20and%20Settings/user/ÃÃÃæ/111.bmp"
target=_blank></A> <WBR></DIV>
<P align=center><A
href="http://photo.blog.sina.com.cn/showpic.html#blogid=3e1311d1010009nw&url=http://static3.photo.sina.com.cn/orignal/3e1311d1ba87a48a4a332"
target=_blank><IMG
src="一个简单MINIGUI软键盘(非常具有参考意义).files/3e1311d1ba87a48a4a332.jpg" border=0></A></P>
<DIV> <WBR></DIV>
<P><FONT face=宋体>/*************************************************<BR>Copyright
(C), 2007-2011, Aurine<BR>File name:
<WBR>au_keybord.c<BR>Author: <WBR> <WBR>
<WBR>许集润<BR>Version: <WBR>
<WBR>1.0<BR>Date:<BR>Description: <WBR> 软键盘</FONT></P>
<P><FONT
face=宋体>History: <WBR> <WBR> <WBR> <WBR> <WBR> <WBR> <WBR><BR>1.
Date: <WBR>2007-07-01<BR>Author:<BR>Modification:<BR>2.
...<BR>*************************************************/<BR>#include
"../include/au_model_func.h"<BR></FONT></P>
<P><FONT face=宋体>#include <stdio.h><BR>#include
<stdlib.h><BR>#include <math.h></FONT></P>
<P><FONT face=宋体>#include <minigui/common.h><BR>#include
<minigui/minigui.h><BR>#include <minigui/gdi.h><BR>#include
<minigui/window.h><BR>#include <minigui/control.h></FONT></P>
<P><FONT face=宋体>#define IDC_EDIT <WBR> <WBR> <WBR>
100<BR>#define KEY_X <WBR> <WBR>100<BR>#define
KEY_Y <WBR> <WBR>150<BR>#define
KEY_W <WBR> <WBR>30<BR>#define
KEY_H <WBR> <WBR>30</FONT></P>
<P><FONT face=宋体>static BITMAP g_back_bmp,g_JTai_bmp;<BR>static RECT
rc_text;<BR>static char num[10]={0};<BR>static int status[4][10];<BR>static int
g_mouse_down=0,g_mouse_up=0;</FONT></P>
<P><FONT face=宋体>static const char *caption[4][10]
=<BR>{<BR> <WBR>{"1","2","3","4","5","6","7","8","9","0"},<BR> <WBR>{"Q","W","E","R","T","Y","U","I","O","P"},<BR> <WBR>{"A","S","D","F","G","H","J","K","L",""},<BR> <WBR>{"Z","X","C","V","B","N","M",".","",""}<BR>};</FONT></P>
<P><FONT face=宋体><BR>//模板-窗体控件定义</FONT></P>
<P>static DLGTEMPLATE DlgInit
=<BR>{<BR> <WBR>DW_STYLE,<BR> <WBR>DW_STYLE_EX,<BR> <WBR>FORM_X,
FORM_Y, 800,
480, <WBR><BR> <WBR>"",<BR> <WBR>0,<BR> <WBR>0,<BR> <WBR>0,//sizeof(Ctrls)/sizeof(CTRLDATA),<BR> <WBR>NULL,//Ctrls,<BR> <WBR>0<BR>};</P>
<P><BR>static void create_ctrl(HWND
hDlg)<BR>{<BR> <WBR>CreateWindow("edit","",<BR> <WBR> <WBR> <WBR>
WS_VISIBLE | WS_TABSTOP | WS_BORDER ,<BR> <WBR> <WBR> <WBR>
IDC_EDIT,<BR> <WBR> <WBR> <WBR> 100, 50, 200,
25,<BR> <WBR> <WBR> <WBR>
hDlg,<BR> <WBR> <WBR> <WBR> 0);</P>
<P>}</P>
<P>static void click_form(HWND hDlg, int x, int y)<BR>{<BR> <WBR>int
i,j,len;<BR> <WBR>char char_tmp[4]={0};<BR> <WBR>RECT rc_keydown;</P>
<P> <WBR>if((x>500 && x<(500+(int)g_back_bmp.bmWidth))
&& (y>400 &&
y<400+(int)g_back_bmp.bmHeight))<BR> <WBR>{ <WBR><BR> <WBR> <WBR>printf("HIDE
dialog\n");<BR> <WBR> <WBR>EndDialog(hDlg,0);<BR> <WBR>}</P>
<P> <WBR>if(x>KEY_X && x< KEY_X + KEY_W*10 && y >
KEY_Y && y < KEY_Y + KEY_H*4)<BR> <WBR>{</P>
<P> <WBR> <WBR>i = (int)floor((y -
KEY_Y)/KEY_H);<BR> <WBR> <WBR>j = (int)floor((x -
KEY_X)/KEY_W);<BR> <WBR> <WBR>printf("the i is : %d \t the j is : %d
\n",i,j);<BR> <WBR> <WBR>len=strlen(num);</P>
<P> <WBR> <WBR>if(g_mouse_down ==
1)<BR> <WBR> <WBR>{<BR> <WBR> <WBR> <WBR>if(len<15)<BR> <WBR> <WBR> <WBR>{<BR> <WBR> <WBR> <WBR> <WBR>printf("the
len is : %d
\n",len);<BR> <WBR> <WBR> <WBR> <WBR>sprintf(char_tmp,"%s",caption[i][j]);<BR> <WBR> <WBR> <WBR> <WBR>printf("the
char_tmp is : %s \n",char_tmp);</P>
<P> <WBR> <WBR> <WBR> <WBR>num[len]=char_tmp[0];<BR> <WBR> <WBR> <WBR> <WBR>printf("the
num is : %s
\n",num);<BR> <WBR> <WBR> <WBR> <WBR>num[len+1]=0;<BR> <WBR> <WBR> <WBR> <WBR>SetWindowText(GetDlgItem(hDlg,IDC_EDIT),num);<BR> <WBR> <WBR> <WBR>}<BR> <WBR> <WBR> <WBR>status[i][j]=1;<BR> <WBR> <WBR> <WBR>g_mouse_down
=
0;<BR> <WBR> <WBR>}<BR> <WBR> <WBR><BR> <WBR> <WBR>if(g_mouse_up
==
1)<BR> <WBR> <WBR>{<BR> <WBR> <WBR> <WBR>status[i][j] =
2;<BR> <WBR> <WBR> <WBR>printf("free mouse
\n");<BR> <WBR> <WBR> <WBR>g_mouse_up =
0;<BR> <WBR> <WBR>}</P>
<P> <WBR> <WBR>rc_keydown.left = KEY_X + KEY_W *
j;<BR> <WBR> <WBR>rc_keydown.top = KEY_Y + KEY_H * i +
1;<BR> <WBR> <WBR>rc_keydown.right = rc_keydown.left +
KEY_W;<BR> <WBR> <WBR>rc_keydown.bottom = rc_keydown.top + KEY_H -
1;</P>
<P> <WBR> <WBR>printf("left:%d,top:%d,right:%d,bottom:%d",rc_keydown.left,rc_keydown.top,rc_keydown.right,rc_keydown.bottom);<BR> <WBR> <WBR>InvalidateRect(hDlg,&rc_keydown,
TRUE);<BR> <WBR>}<BR>}</P>
<P><BR>static void draw_text(HWND hDlg,HDC hdc)<BR>{<BR> <WBR>int
i,x,y,j;<BR> <WBR>FillBoxWithBitmap(hdc, 500, 400,
0,0,&g_back_bmp);<BR> <WBR><BR> <WBR>x = KEY_X;<BR> <WBR>y =
KEY_Y;</P>
<P>//这是我自己写的画有立体感的矩形边框<BR> <WBR>draw_rect(hdc,KEY_X,KEY_Y,KEY_W*10,KEY_H*4,PIXEL_MAINCOLOR,<BR> <WBR>
<WBR> <WBR> <WBR>PIXEL_SHALLOWCOLOR,PIXEL_DEEPCOLOR,1,2,1,1);</P>
<P> <WBR>SetPenColor(hdc,PIXEL_DEEPCOLOR);</P>
<P> <WBR>for(i=0;i<3;i++)<BR> <WBR>{ <WBR> <WBR><BR> <WBR> <WBR>y
= KEY_Y + KEY_H * (i + 1);<BR> <WBR> <WBR>LineEx (hdc,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -