#pragma once
#include "global.h"
#include "MyStructDef.h"
class CPidEditorDraw : public CDialog
{
	DECLARE_DYNAMIC(CPidEditorDraw)
	DECLARE_MESSAGE_MAP()
public:
	CPidEditorDraw(CWnd* pParent = nullptr);   // 标准构造函数
	virtual ~CPidEditorDraw();
	// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_CPIDEDITOR_DRAW };
#endif
	void* pParentEditor = nullptr;
	MyView* GetMyView();
	void Draw();
	void Load(CString filename);//载入贴图png文件
	void ResetContext();
	MyRect GetCopyRect();
	void SetCopyRect(MyRect& rc);
	BOOL PreTranslateMessage(MSG* pMsg) override;
protected:
	void DoDataExchange(CDataExchange* pDX) override;
	BOOL OnInitDialog() override;
public:
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnPaint();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
private:
	//渲染器
	MyDX11Renderer pRenderer;
	MyView view;
	void DrawID();
	void DrawPid();//绘制pid
	void DrawNumber(float x, float y, int num);
	//载入的贴图
	MyTextureAndSRV tas;
	TTF_Font* pFont_sourcesun14 = nullptr;//字体
	std::unordered_map<wchar_t, MyFontData> pFontMap70;
	//右键菜单
	CPoint rclick_last_pt;
};

