line.h

来自「一个折线不重复相交的程序, 一家日本公司的程序员上机题」· C头文件 代码 · 共 54 行

H
54
字号
#pragma once

#include <math.h>

#include <list>
using namespace std;

struct Line
{
    POINT pos_1;
	POINT pos_2;
};

class CLine
{
private:
	list< POINT > m_PosList;
	list< POINT > m_PosPart_Left;
	list< POINT > m_PosPart_Right;

	int           m_posWidth;

	POINT         m_nowpos;
	POINT         m_mousepos;
	Line          m_mouseline;

	//文字
	TCHAR         m_TxT[512];

public:
	CLine(void);
	~CLine(void);

	void InsertPos( );
	void InsertPos( POINT pos );
	void InsertPos( int x, int y );

	void SetNowPos( POINT pos );
	void SetNowPos( int x, int y );

	void SetMousePos( POINT pos );
	void SetMousePos( int x, int y );

	void DrawLine( HDC hdc );

	void GetStartPos( POINT& pos );
	void GetEndPos( POINT& pos );

private:
	BOOL CheckLine( Line line1, Line line2 ); //如果相交, 则返回TRUE
};

extern CLine* g_line;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?