⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphviewctl.h

📁 《Visual C++视频/音频开发实用工程案例精选》一书的源代码
💻 H
字号:
#if !defined(AFX_GRAPHVIEWCTL_H__A1E4CA46_6539_422F_9C9E_6F4B5867B348__INCLUDED_)
#define AFX_GRAPHVIEWCTL_H__A1E4CA46_6539_422F_9C9E_6F4B5867B348__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// GraphViewCtl.h : Declaration of the CGraphViewCtrl ActiveX Control class.

/////////////////////////////////////////////////////////////////////////////
// CGraphViewCtrl : See GraphViewCtl.cpp for implementation.

class CGraphViewCtrl : public COleControl
{
	DECLARE_DYNCREATE(CGraphViewCtrl)

// Constructor
public:
	CGraphViewCtrl();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CGraphViewCtrl)
	public:
	virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
	virtual void DoPropExchange(CPropExchange* pPX);
	virtual void OnResetState();
	//}}AFX_VIRTUAL

// Implementation
protected:
	~CGraphViewCtrl();

	DECLARE_OLECREATE_EX(CGraphViewCtrl)    // Class factory and guid
	DECLARE_OLETYPELIB(CGraphViewCtrl)      // GetTypeInfo
	DECLARE_OLECTLTYPE(CGraphViewCtrl)		// Type name and misc status

// Message maps
	//{{AFX_MSG(CGraphViewCtrl)
		// NOTE - ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Dispatch maps
	//{{AFX_DISPATCH(CGraphViewCtrl)
	OLE_COLOR m_foreColor;
	afx_msg void OnForeColorChanged();
	long m_lineType;
	afx_msg void OnLineTypeChanged();
	long m_lineWidth;
	afx_msg void OnLineWidthChanged();
	OLE_COLOR m_backColor;
	afx_msg void OnBackColorChanged();
	afx_msg void Clear();
	afx_msg void SetScale(double x1, double y1, double x2, double y2);
	afx_msg void LineTo(double x, double y);
	afx_msg void MoveTo(double x, double y);
	afx_msg void Multiline(long segments, double FAR* xi, double FAR* yi);
	afx_msg void DrawLine(double x1, double y1, double x2, double y2);
	//}}AFX_DISPATCH
	DECLARE_DISPATCH_MAP()

// Event maps
	//{{AFX_EVENT(CGraphViewCtrl)
	//}}AFX_EVENT
	DECLARE_EVENT_MAP()

private:
	//Private Members
	CPen*	ptrPen;							// Pen for drawing lines
	CBrush*	ptrBrush;						// Brush for filling areas
	CPoint	penpos;							// Current pen position

	//Coordinates
	double	x1world, x2world;				
	double	y1world, y2world;
	double	dxworld, dyworld;
	int		dxwin, dywin;

	//Coord Conversion Methods
	CPoint WorldToWindows(double x, double y);

// Dispatch and event IDs
public:
	enum {
	//{{AFX_DISP_ID(CGraphViewCtrl)
	dispidForeColor = 1L,
	dispidLineType = 2L,
	dispidLineWidth = 3L,
	dispidBackColor = 4L,
	dispidClear = 5L,
	dispidSetScale = 6L,
	dispidLineTo = 7L,
	dispidMoveTo = 8L,
	dispidMultiline = 9L,
	dispidDrawLine = 10L,
	//}}AFX_DISP_ID
	};
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_GRAPHVIEWCTL_H__A1E4CA46_6539_422F_9C9E_6F4B5867B348__INCLUDED)

⌨️ 快捷键说明

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