代码拉取完成,页面将自动刷新
#include "stdafx.h"
#include "Shape.h"
CEllipse::CEllipse() {
startPoint.x = 0;
startPoint.y = 0;
endPoint.x = 0;
endPoint.y = 0;
}
CEllipse::CEllipse(POINT start, POINT end) {
startPoint = start;
endPoint = end;
}
CEllipse::~CEllipse() {
}
void CEllipse::Draw(Graphics *graphic) {
if (pressedShift) {
ChangeEndIfShift(startPoint, endPoint);
}
POINT topLeft;
int width = 0;
int height = 0;
if (startPoint.x > endPoint.x) {
if (startPoint.y > endPoint.y) {
topLeft = endPoint;
width = startPoint.x - endPoint.x;
height = startPoint.y - endPoint.y;
}
else {
topLeft.x = endPoint.x;
topLeft.y = startPoint.y;
width = startPoint.x - endPoint.x;
height = endPoint.y - startPoint.y;
}
}
else {
if (startPoint.y > endPoint.y) {
topLeft.x = startPoint.x;
topLeft.y = endPoint.y;
width = endPoint.x - startPoint.x;
height = startPoint.y - endPoint.y;
}
else {
topLeft = startPoint;
width = endPoint.x - startPoint.x;
height = endPoint.y - startPoint.y;
}
}
graphic->DrawEllipse(pen, topLeft.x, topLeft.y, width, height);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。