Добавил:
sergey123
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:
#pragma once
#include "Figure.h"
namespace Project2
{
using namespace System;
using namespace System::Drawing;
using namespace System::Drawing::Drawing2D;
ref class Scene
{
public:
double gapPositionAngle;//+
double wallX;
double radius;//+
double gapAngle;//+
private:
double startAngle;
double endAngle;
public:
void ApplyEndAngle()
{
endAngle = (gapPositionAngle - gapAngle < 0) ? 2*PI + gapPositionAngle - gapAngle : Math::Abs(gapPositionAngle - gapAngle);
}
void Init()
{
startAngle = gapPositionAngle + gapAngle;
endAngle = 2*PI + gapPositionAngle - gapAngle;
//ApplyEndAngle();
}
Bitmap^ Draw()
{
Bitmap^ sceneImage = gcnew Bitmap(250, 250);
Graphics^ graphics = Graphics::FromImage(sceneImage);
double _startAngle = -(startAngle*180)/PI;
double _endAngle = -(endAngle*180)/PI;
double _swipeAngle = _endAngle-_startAngle;
GraphicsPath^ myPath = gcnew GraphicsPath();
myPath->StartFigure();
myPath->AddArc(int(125-radius), int(125-radius), 2*radius, 2*radius, _startAngle, _swipeAngle);//-Math::Sign(startAngle)*Math::Abs(endAngle-startAngle));
//myPath->CloseFigure();
graphics->DrawPath(gcnew Pen(Color::Blue), myPath);
graphics->DrawLine(gcnew Pen(Color::Black, 3), (int)wallX+125, (int)20, (int)wallX+125, (int)230);
graphics->DrawLine(gcnew Pen(Color::Black, 3), 0, 0, 0, 250);
graphics->DrawLine(gcnew Pen(Color::Black, 3), 0, 0, 250, 0);
graphics->DrawLine(gcnew Pen(Color::Black, 3), 250, 0, 250, 250);
graphics->DrawLine(gcnew Pen(Color::Black, 3), 0, 250, 250, 250);
delete graphics;
return sceneImage;
}
};
}
Соседние файлы в папке Project2