1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#include <windows.h>
#include <string>
using namespace std;
void ReadFiles(int &id1, int &x1, int &y1,
int &id2, int &x2, int &y2,
char* &t, int &p5)
{
p5 = 5;
// other stuff
}
void DrawLine(HDC hdc, int &x, int &y, int &xx, int &yy)
{
POINT pt[2];
pt[0].x = x;
pt[0].y = y;
pt[1].x = xx;
pt[1].y = yy;
Polyline (hdc, pt, 2);
}
void DrawEdge(HDC hdc)
{
int id1, x1, y1, id2, x2, y2, tx, ty, p5;
char* t = "";
ReadFiles(id1, x1, y1, id2, x2, y2, t, p5);
string treat = t;
if (x1 < x2 && y1 == y2) /*IF toLEFT*/
{
DrawLine(hdc, x1, y1, x2, y2);
// method of adding reference to reference
DrawLine(hdc, x1, y1, x1+p5, y1+p5);
DrawLine(hdc, x1, y1, x1+p5, y1-p5);
TextOut(hdc,tx,ty,t,treat.size());
}
else if (x1 == x2 && y1 < y2) /*IF toUP*/
{
DrawLine(hdc, x1, y1, x2, y2);
// method of adding regular int to reference
DrawLine(hdc, x1, y1, x1+5, y1+5);
DrawLine(hdc, x1, y1, x1-5, y1+5);
TextOut(hdc,tx,ty,t,treat.size());
}
else MessageBox(NULL, "Diagonal paths not allowed!", "ERROR",
MB_ABORTRETRYIGNORE | MB_ICONWARNING);
}
|