| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5961 人关注过本帖
标题:我是菜鸟!!请问紫光、搜狗、谷歌等输入法用什么编程软件编写的?
只看楼主 加入收藏
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 
汗了 输入法有什么界面
2007-07-05 12:35
酒肉弥勒佛
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:399
专家分:0
注 册:2006-6-6
收藏
得分:0 
属性设置阿,拼音加加就有,其他的没用过

编程是为了提高效率,好的程序是因为他的高效;在编程的道路上,永远追逐高效的算法
2007-07-05 13:04
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 

那能有多少
一般的程序员用C一天也搞定了

2007-07-05 13:06
酒肉弥勒佛
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:399
专家分:0
注 册:2006-6-6
收藏
得分:0 
是吗,这么牛
那你用C写个按钮,写个列表框,写个复选按钮,写个滚动条看看
在用C写个文本框,让我能在里面输入东西

你肯定没有用C写过!!!!

编程是为了提高效率,好的程序是因为他的高效;在编程的道路上,永远追逐高效的算法
2007-07-05 13:12
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 
我晕了
这个相当好写
2007-07-05 13:20
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 

这是简单的五子棋程序,你自己去运行一下看看吧:


#include <windows.h>
#include <math.h>

#define CB_SIDE_X 50 //棋盘左上角X轴位置
#define CB_SIDE_Y 60 //棋盘左上角Y轴位置
#define CB_LEN 15 //棋盘长度(行列数)
#define CB_WIDTH 30 //棋盘格宽
#define CHESS_WIDTH 13
#define IDE_RESULT 101
#define IDB_NUM7 117
#define IDB_NUM8 118

typedef struct ChessDef
{
int CB_MaxWidth ;
COLORREF chessColor_White ;
COLORREF chessColor_Black ;
};

typedef struct Site
{
int x ;
int y ;
};

int chessMan[CB_LEN][CB_LEN] = {0} ;
Site mouse ;
int flag = 1, chessKey = 0;
char gameState = 0 ;
RECT moveSite ;
HWND hwnd ;
ChessDef chess ;
int cxClient, cyClient ;
HWND hEditResult, hButtonOptSum1_Restart, hButtonOptSum1_Exit ;
HINSTANCE hInst ;

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int drawChessBroad(HDC hdc, ChessDef chess) ;
void drawMouseSite(HDC hdc) ;
int checkChessWin(Site checkSize) ;
int Restart() ;
int outGame(int mode) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("SineWave") ;
MSG msg ;
WNDCLASS wndclass;

wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc= WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground= (HBRUSH) GetStockObject (LTGRAY_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;

if (!RegisterClass (&wndclass))
{
MessageBox ( NULL, TEXT ("Program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}

hwnd = CreateWindow ( szAppName, TEXT ("五子棋"),
WS_OVERLAPPEDWINDOW,
10, 10,
800, 600,
NULL, NULL, hInstance, NULL) ;

ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;

while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}

return msg.wParam ;
}


LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc ;
PAINTSTRUCT ps ;
RECT rect;
Site recordSize ;

chess.CB_MaxWidth = (CB_LEN-1)*CB_WIDTH;
chess.chessColor_White = RGB (255, 255, 255) ;
chess.chessColor_Black = RGB (0, 0, 0) ;

GetSysColorBrush(20);

switch (message)
{
case WM_CREATE:
hEditResult=CreateWindow("EDIT", //建立文本框
NULL,
WS_CHILD | WS_VISIBLE | ES_RIGHT | WS_BORDER,
530,60,
160,24,
hwnd,
(HMENU)IDE_RESULT,
hInst,
NULL);
SetWindowText(hEditResult,"进行时");
hButtonOptSum1_Restart=CreateWindow("BUTTON", //建立按钮7
"重新开始",
WS_CHILD | WS_VISIBLE,
530,140,
80,30,
hwnd,
(HMENU) IDB_NUM7,
hInst,
NULL);
hButtonOptSum1_Exit=CreateWindow("BUTTON", //建立按钮7
"退出",
WS_CHILD | WS_VISIBLE,
530,180,
80,30,
hwnd,
(HMENU) IDB_NUM8,
hInst,
NULL);
break ;

case WM_SIZE:
cxClient = LOWORD (lParam) ;
cyClient = HIWORD (lParam) ;
return 0 ;

case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;

drawChessBroad(hdc, chess) ;

EndPaint (hwnd, &ps) ;

return 0 ;

case WM_LBUTTONDOWN :
mouse.x = LOWORD (lParam) ;
mouse.y = HIWORD (lParam) ;

if(!gameState
&&mouse.x < CB_SIDE_X+chess.CB_MaxWidth+CHESS_WIDTH
&& mouse.y < CB_SIDE_Y+chess.CB_MaxWidth+CHESS_WIDTH
&& mouse.x > CB_SIDE_X-CHESS_WIDTH
&& mouse.y > CB_SIDE_X-CHESS_WIDTH)
{

InvalidateRect (hwnd, &moveSite, FALSE) ;
recordSize.x = (mouse.x-CB_SIDE_X)/CB_WIDTH ;
recordSize.y = (mouse.y-CB_SIDE_Y)/CB_WIDTH ;
if(!chessMan[recordSize.x][recordSize.y])
{
chessMan[recordSize.x][recordSize.y] = chessKey+1 ;
if(checkChessWin(recordSize) != 255)
{
if(chessKey)
SetWindowText(hEditResult,"黑棋胜利");
else
SetWindowText(hEditResult,"白棋胜利");
gameState = 1;
}
else
{
chessKey = !chessKey ;
if(chessKey)
SetWindowText(hEditResult,"黑棋");
else
SetWindowText(hEditResult,"白棋");
}
}
}
return 0;

case WM_MOUSEMOVE:
mouse.x = LOWORD (lParam) ;
mouse.y = HIWORD (lParam) ;

if(mouse.x < CB_SIDE_X+chess.CB_MaxWidth+CB_WIDTH
&& mouse.y < CB_SIDE_Y+chess.CB_MaxWidth+CB_WIDTH
&& mouse.x > CB_SIDE_X-CB_WIDTH
&& mouse.y > CB_SIDE_Y-CB_WIDTH)
{
if(flag == 1)
{
InvalidateRect (hwnd, NULL, FALSE) ;
}
else
{
InvalidateRect (hwnd, &moveSite, FALSE) ;
}

flag = 0;
}
else
{
flag = 1;
}
return 0;

case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDB_NUM7:
Restart() ;
break ;
case IDB_NUM8:
outGame(1);
break;
}
return 0;
}

return DefWindowProc (hwnd, message, wParam, lParam) ;
}

int drawChessBroad(HDC hdc, ChessDef chess)
{
int i, j;
HBRUSH hBrush ;

hBrush = CreateSolidBrush (RGB(255, 50, 255)) ;
SelectObject (hdc, hBrush) ;

Rectangle(hdc
, CB_SIDE_X-CB_WIDTH
, CB_SIDE_Y-CB_WIDTH
, CB_SIDE_X+chess.CB_MaxWidth+CB_WIDTH
, CB_SIDE_Y+chess.CB_MaxWidth+CB_WIDTH);

DeleteObject (hBrush) ;

if(mouse.x < CB_SIDE_X+chess.CB_MaxWidth+CB_WIDTH
&& mouse.y < CB_SIDE_Y+chess.CB_MaxWidth+CB_WIDTH
&& mouse.x > CB_SIDE_X-CB_WIDTH
&& mouse.y > CB_SIDE_Y-CB_WIDTH)
{
drawMouseSite(hdc);
}

for(i = 0;i < CB_LEN;i++)
{
MoveToEx (hdc, i*CB_WIDTH+CB_SIDE_X, CB_SIDE_Y, NULL) ;
LineTo(hdc, i*CB_WIDTH+CB_SIDE_X, chess.CB_MaxWidth+CB_SIDE_Y) ;

MoveToEx (hdc, CB_SIDE_X, i*CB_WIDTH+CB_SIDE_Y, NULL) ;
LineTo(hdc,chess.CB_MaxWidth+CB_SIDE_X , i*CB_WIDTH+CB_SIDE_Y) ;
}
for(i = 0;i < CB_LEN;i++)
for(j = 0;j < CB_LEN;j++)
{

if(chessMan[i][j] == 1)
{
hBrush = CreateSolidBrush (chess.chessColor_White) ;
SelectObject (hdc, hBrush) ;
Ellipse (hdc
, i*CB_WIDTH+CB_SIDE_X-CHESS_WIDTH
, j*CB_WIDTH+CB_SIDE_Y-CHESS_WIDTH
, i*CB_WIDTH+CB_SIDE_X+CHESS_WIDTH
, j*CB_WIDTH+CB_SIDE_Y+CHESS_WIDTH) ;
DeleteObject (hBrush) ;
}
if(chessMan[i][j] == 2)
{
hBrush = CreateSolidBrush (chess.chessColor_Black) ;
SelectObject (hdc, hBrush) ;
Ellipse (hdc
, i*CB_WIDTH+CB_SIDE_X-CHESS_WIDTH
, j*CB_WIDTH+CB_SIDE_Y-CHESS_WIDTH
, i*CB_WIDTH+CB_SIDE_X+CHESS_WIDTH
, j*CB_WIDTH+CB_SIDE_Y+CHESS_WIDTH) ;
DeleteObject (hBrush) ;
}
}

}

void drawMouseSite(HDC hdc)
{
HBRUSH hBrush ;

moveSite.top = ((mouse.y-CB_SIDE_Y)/CB_WIDTH)*CB_WIDTH+CB_SIDE_Y-CHESS_WIDTH-3 ;
moveSite.left = ((mouse.x-CB_SIDE_X)/CB_WIDTH)*CB_WIDTH+CB_SIDE_X-CHESS_WIDTH-3 ;
moveSite.bottom = ((mouse.y-CB_SIDE_Y)/CB_WIDTH)*CB_WIDTH+CB_SIDE_Y+CHESS_WIDTH+3 ;
moveSite.right = ((mouse.x-CB_SIDE_X)/CB_WIDTH)*CB_WIDTH+CB_SIDE_X+CHESS_WIDTH+3 ;

hBrush = CreateSolidBrush (RGB(252, 50, 0)) ;

SelectObject (hdc, hBrush) ;

Rectangle(hdc, moveSite.left, moveSite.top, moveSite.right, moveSite.bottom);

DeleteObject (hBrush) ;
}
/*
5 4 6
\|/
1 - - 3
/|\
7 2 8
*/
int checkChessWin(Site checkSize)
{
int i, j ;
int flagDirect = 0 ;

for(i = 1;i < 5;i++)
{
// 1
if(checkSize.x+i >= CB_LEN
|| chessMan[checkSize.x+i][checkSize.y] != chessKey+1)
{
flagDirect = flagDirect|1 ;
}
// 2
if(checkSize.y+i >= CB_LEN
|| chessMan[checkSize.x][checkSize.y+i] != chessKey+1)
{
flagDirect = flagDirect|2 ;
}
// 3
if(checkSize.x-i < 0
|| chessMan[checkSize.x-i][checkSize.y] != chessKey+1)
{
flagDirect = flagDirect|4 ;
}
// 4
if(checkSize.y-i < 0
|| chessMan[checkSize.x][checkSize.y-i] != chessKey+1)
{
flagDirect = flagDirect|8 ;
}
// 5
if(checkSize.x-i < 0 && checkSize.y-i < 0
|| chessMan[checkSize.x-i][checkSize.y-i] != chessKey+1)
{
flagDirect = flagDirect|16 ;
}
// 6
if(checkSize.x+i >= CB_LEN && checkSize.y-i < 0
|| chessMan[checkSize.x+i][checkSize.y-i] != chessKey+1)
{
flagDirect = flagDirect|32 ;
}
// 7
if(checkSize.x-i < 0 && checkSize.y+i >= CB_LEN
|| chessMan[checkSize.x-i][checkSize.y+i] != chessKey+1)
{
flagDirect = flagDirect|64 ;
}
// 8
if(checkSize.x+i >= CB_LEN && checkSize.y+i >= CB_LEN
|| chessMan[checkSize.x+i][checkSize.y+i] != chessKey+1)
{
flagDirect = flagDirect|128 ;
}
}

return flagDirect;
}

int Restart()
{
int i, j;

for(i = 0;i < CB_LEN;i++)
for(j = 0;j < CB_LEN;j++)
{
chessMan[i][j] = 0;
}
flag = 1 ;
chessKey = 0;
gameState = 0;

SetWindowText(hEditResult,"进行时");

InvalidateRect (hwnd, NULL, FALSE) ;
}

int outGame(int mode)
{

switch(mode)
{
case 0:
exit(0);
case 1:

if(MessageBox(hwnd, "是否要退出游戏", "五子棋", MB_YESNO) == 7)
{
InvalidateRect (hwnd, NULL, FALSE) ;
return 0;
}
exit(0);
}
}

2007-07-05 13:21
爱以走远
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:52
帖 子:7542
专家分:21
注 册:2007-3-16
收藏
得分:0 

你们两个就不要在说拉
偶都无语拉
怎么说拉 用c写这些 写是写得出来
但是没意思 何必呢
高级语言好多拉
学c主要是学思路
算法

[此贴子已经被作者于2007-7-5 13:23:37编辑过]


   好好活着,因为我们会死很久!!!
2007-07-05 13:23
killer_l
Rank: 2
等 级:新手上路
威 望:3
帖 子:1139
专家分:0
注 册:2007-5-25
收藏
得分:0 
和谐社会

2007-07-05 13:24
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 
实在闲着没事
2007-07-05 13:37
酒肉弥勒佛
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:399
专家分:0
注 册:2006-6-6
收藏
得分:0 
不好意思,我用的是linux,所以不能运行这个程序,你要是不介意的话,把界面贴过我看看

编程是为了提高效率,好的程序是因为他的高效;在编程的道路上,永远追逐高效的算法
2007-07-05 13:42
快速回复:我是菜鸟!!请问紫光、搜狗、谷歌等输入法用什么编程软件编写的?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032307 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved