免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 2691 | 回复: 10
打印 上一主题 下一主题

[C] 如何在TC下使用汉字? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-23 17:07 |只看该作者 |倒序浏览
我想在TC下使用汉字或者能编译出能显彩色的的汉字和背景,
请能否实现,如果能,怎么实现啊?

论坛徽章:
0
2 [报告]
发表于 2008-05-23 17:37 |只看该作者
能,去找字库,用像素一个点一个点的把字描出来。

论坛徽章:
0
3 [报告]
发表于 2008-05-23 20:22 |只看该作者
能说具体点吗?字库在哪可以找到,是什么字库?
用像素怎么描啊。

论坛徽章:
0
4 [报告]
发表于 2008-05-24 08:53 |只看该作者
ucdos

论坛徽章:
0
5 [报告]
发表于 2008-05-24 12:50 |只看该作者
我找到了更好的方法,直接用vc,调用系统函数system就可以改变字体颜色和背景色。

论坛徽章:
0
6 [报告]
发表于 2008-05-24 23:45 |只看该作者
函数名: setbkcolor
功  能: 用调色板设置当前背景颜色
用  法: void far setbkcolor(int color);
程序例:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* select a driver and mode that supports */
   /* multiple background colors.            */
   int gdriver = EGA, gmode = EGAHI, errorcode;
   int bkcol, maxcolor, x, y;
   char msg[80];

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1); /* terminate with an error code */
   }

   /* maximum color index supported */
   maxcolor = getmaxcolor();

   /* for centering text messages */
   settextjustify(CENTER_TEXT, CENTER_TEXT);
   x = getmaxx() / 2;
   y = getmaxy() / 2;

   /* loop through the available colors */
   for (bkcol=0; bkcol<=maxcolor; bkcol++)
   {
      /* clear the screen */
      cleardevice();

      /* select a new background color */
      setbkcolor(bkcol);

      /* output a messsage */
      if (bkcol == WHITE)
  setcolor(EGA_BLUE);
      sprintf(msg, "Background color: %d", bkcol);
      outtextxy(x, y, msg);
      getch();
   }

   /* clean up */
   closegraph();
   return 0;
}








函数名: setcolor
功  能: 设置当前画线颜色
用  法: void far setcolor(int color);
程序例:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* select a driver and mode that supports */
   /* multiple drawing colors.               */
   int gdriver = EGA, gmode = EGAHI, errorcode;
   int color, maxcolor, x, y;
   char msg[80];

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1); /* terminate with an error code */
   }

   /* maximum color index supported */
   maxcolor = getmaxcolor();

   /* for centering text messages */
   settextjustify(CENTER_TEXT, CENTER_TEXT);
   x = getmaxx() / 2;
   y = getmaxy() / 2;

   /* loop through the available colors */
   for (color=1; color<=maxcolor; color++)
   {
      /* clear the screen */
      cleardevice();

      /* select a new background color */
      setcolor(color);

      /* output a messsage */
      sprintf(msg, "Color: %d", color);
      outtextxy(x, y, msg);
      getch();
   }

   /* clean up */
   closegraph();
   return 0;
}

论坛徽章:
0
7 [报告]
发表于 2008-05-25 16:44 |只看该作者
哟,还有人在用 TC 啊,不是教师就是学生,看我猜得对不对

论坛徽章:
0
8 [报告]
发表于 2008-05-25 22:36 |只看该作者
我是大一的。刚学C

论坛徽章:
0
9 [报告]
发表于 2008-05-26 16:11 |只看该作者
原帖由 戒不掉的烟民 于 2008-5-25 22:36 发表
我是大一的。刚学C

  让我说着了吧

论坛徽章:
0
10 [报告]
发表于 2008-05-27 15:18 |只看该作者
TC。。老掉牙了,也就我们这些学生用了。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP