textwidth

textwidth--是一个函数的名称,功能为返回以像素为单位的字符串宽度。
基础资料
  • 外文名:textwidth
  • 本质:电脑函数
  • 功能:返回以像素为单位的字符串宽度
  • 简介

    函数功能

    函数名: textwidth

    功 能: 返回以像素为单位的字符串宽度

    用 法: int far textwidth(char far *textstring);

    程序示例

    #include

    #include

    #include

    #include

    int main(void)

    {

    /* request auto detection */

    int gdriver = DETECT, gmode, errorcode;

    int x = 0, y = 0;

    int i;

    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 */

    }

    y = getmaxy() / 2;

    settextjustify(LEFT_TEXT, CENTER_TEXT);

    for (i=1; i<11; i++)

    {

    /* select the text style, direction, and size */

    settextstyle(TRIPLEX_FONT, HORIZ_DIR, i);

    /* create a message string */

    sprintf(msg, "Size: %d", i);

    /* output the message */

    outtextxy(x, y, msg);

    /* advance to the end of the text */

    x += textwidth(msg);

    }

    /* clean up */

    getch();

    closegraph();

    return 0;

    }

    首页
    科技
    #贵族
    最新入驻
    贾科莫·普契尼
    Caroline Lufkin
    翁建宇
    相关阅读
    NDSi XL
    内容词条·2512人浏览
    ndsill
    内容词条·3451人浏览
    网络唤醒
    内容词条·4288人浏览
    音视频转换器
    内容词条·7058人浏览
    序列分组交换协议
    内容词条·2291人浏览
    vhdl
    内容词条·7067人浏览
    • 网站地图
    • |

    Copyright 2023 fuwu029.com赣ICP备2022008914号-4