outtextxy函数_C / C ++中的图形:带有示例的OUTTEXTXY和SETTEXTSTYLE函数

outtextxy函数

In today's advanced Advance Learning Tutorial, you will learn how to print any string in the graphics mode?

在今天的高级高级学习教程中,您将学习如何在图形模式下打印任何字符串

1)OUTTEXTXY (1) OUTTEXTXY)

In the Graphics mode, if a function is given to print any string that is done using outtextxy.

在“图形”模式下,如果给出了一个函数来打印使用outtextxy完成的任何字符串。

Prototype:

原型:

    outtextxy (int x , int y , "Text");

Note: This function works only on the graphics mode.

注意:此功能仅在图形模式下有效。

int x and y denote the current position and it is in pixel form.

int x和y表示当前位置,并且为像素形式。

Example:

例:

    outtextxy(10, 10, "Welcome to the Tutorial of Graphics");

The outtextxy character uses the current font, current direction, and current size.

outtextxy字符使用当前字体,当前方向和当前大小。

2)SETTEXTSTYLE (2) SETTEXTSTYLE)

The function setstextstyle() is used to set these three attributes of any text.

函数setstextstyle()用于设置任何文本的这三个属性。

Prototype:

原型:

    settextstyle(int font , int direction , int charsize);

settextstyle sets font, direction and char size of the text.

settextstyle设置文本的字体,方向和字符大小。

Note: This function needs to be called before the outtextxy() function, otherwise there will be no effect on text and output will be the same.

注意:此函数需要在outtextxy()函数之前调用,否则对文本没有影响,并且输出将相同。

Graphics system of C ++ supports 8x8 bitmapped font system.

C ++的图形系统支持8x8位图字体系统。

Directions

方向

It supports two types of directions:

它支持两种类型的方向:

  1. Horizontal text (left to right )

    水平文字(从左到右)

  2. Vertical text (right to left )

    垂直文字(从右到左)

By default, the direction is the horizontal direction. For the horizontal direction, value zero (0) and the value one (1) is passed for the vertical direction.

默认情况下,方向是水平方向。 对于水平方向,将值零(0)和值一(1)用于垂直方向。

Char Size:

字符大小:

This is also an integer value. You can extend the size of text up to 10 times. The starting value is 0 as if you increase the value, the font size will increase.

这也是一个整数值。 您最多可以将文本的大小扩展10倍。 起始值为0,就好像您增加该值一样,字体大小也会增加。

Example:

例:

    settextstyle(8,0,3);
    setcolor("RED");
    outtextxy(150,180,"Welcome to the Tutorial of Graphics");

That's all for Learning Tutorial of Graphics in C/C++. If you have any problem in any of the topics mentioned above, then you can ask your questions in the comments section below.

这就是C / C ++学习图形教程的全部内容。 如果您对上述主题有任何疑问,可以在下面的评论部分中提问。

翻译自: https://www.includehelp.com/c/OUTTEXTXY-and-SETTEXTSTYLE-functions-with-example.aspx

outtextxy函数

  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值