📄 d_textsh.h
字号:
#ifndef TEXT_SHAPE_CLASS
#define TEXT_SHAPE_CLASS
#include <string>
#include "d_shape.h"
using namespace std;
class textShape: public shape
{
public:
textShape(double x = 0.0, double y = 0.0,
const string& s ="", shapeColor c = darkgray);
// constructor. has arguments for the base point,
// text string and color
string getText() const;
void setText(const string& s);
// retrieve or set the text
virtual void draw();
// draw the text
private:
string text;
// text to draw
};
textShape::textShape(double x, double y, const string& s,
shapeColor c):
shape(x,y,c), text(s)
{}
string textShape::getText() const
{
return text;
}
void textShape::setText(const string& s)
{
text = s;
}
void textShape::draw()
{
EZDCOLORVAL old_color;
old_color = ezdSetColor(color.convertToEzdColor());
// execute primitive function and draw the text
shape_handle = ezdDrawText(text.c_str(), baseX, baseY);
ezdSetColor(old_color);
}
#endif // TEXT_SHAPE_CLASS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -