∵B点坐标为(3,5)、A点坐标为(0,1),
∴AE=3,BE=4,
∵正方形ABCD,
∴AD=AB,
∵∠BAE+∠DAF=∠DAF+∠FAD,
在Rt△AEB和Rt△DFA中,
AB=AD
∠BAE=∠ADF
,
∴在Rt△AEB和Rt△DFA中,
∴AF=BE=4,DF=AE=3,
∴D点的坐标为(-4,4);
D(-4,4);
zuobiaozhou.h#ifndef ZUOBIAOZHOU_H
#define ZUOBIAOZHOU_H
#include <QtGui>
class zuobiaozhou : public QWidget
{
Q_OBJECT
public:
zuobiaozhou(QWidget *parent = 0)
~zuobiaozhou()
protected:
void paintEvent(QPaintEvent *)
}
#endif // ZUOBIAOZHOU_H
main.cpp
#include <QtGui/QApplication>
#include "zuobiaozhou.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv)
zuobiaozhou w
w.showMaximized() //窗口默认最大化
return a.exec()
}
zuobiaozhou.cpp
#include "zuobiaozhou.h"
zuobiaozhou::zuobiaozhou(QWidget *parent)
: QWidget(parent)
{
setWindowTitle(tr("zuobiaozhou")) //设置标题栏标题
resize(400,300) //设置窗口初始大小
}
zuobiaozhou::~zuobiaozhou()
{
}
void zuobiaozhou::paintEvent(QPaintEvent *)
{
int side = qMin(width(), height()) //创建窗口宽高参数
QPainter painter(this)
painter.setRenderHint(QPainter::Antialiasing,true) //开启抗锯齿
painter.translate(width() / 2, height() / 2) //坐标系统平移变换
painter.scale(side / 300.0, side / 300.0) //坐标系统比例变换,使绘制的图形随窗口的放大而放大
painter.scale(1, -1) //Y轴向上翻转,翻转成正常平面直角坐标系
painter.setPen(QPen(Qt::black, height() / 600))
painter.drawLine(-2000,0,2000,0)
painter.drawLine(0,1500,0,-1500)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)