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

📄 datashow.h

📁 介绍一个动态数据显示类平时写程序时经常需要示波器显示数据。但是好的控件不是免费的。由于程序的需要
💻 H
字号:
/************************************************************************/
/* /* 数据显示类:
   作者:南京航空航天大学能源与动力学院 庄三少
                                   2009年1月11日  
   Email:viualsan@yahoo.cn
     tel:13512524413 
   说明:
      本类无任何限制,可自由改动传播。只需附上该段说明。                                                                   */
/************************************************************************/
#if !defined(AFX_DATASHOW_H__50A0E545_1AFF_4752_9317_5ACBACA5073D__INCLUDED_)
#define AFX_DATASHOW_H__50A0E545_1AFF_4752_9317_5ACBACA5073D__INCLUDED_

#define   IDC_SAVE_BMP   1
#define   IDC_SAVE_DATA   2
#define   IDC_SET_DATA_COLOR 3


#define   IDC_SET_AXIS_COLOR 4
#define   IDC_SET_XYLEBAL_COLOR 5
#define   IDC_SET_TITLE_COLOR 6
#define   IDC_SET_CROSSLINE_COLOR 7
#define   IDC_SET_GRID_COLOR 8
#define   IDC_SET_BK_COLOR 9
#define   IDC_SET_FACE_COLOR 10
#define   IDC_DATA_INPUT 11
#define   IDC_SET_GRID_ON_OFF 12
#define   IDC_SET_NOTE_ON_OFF 13
#define   IDC_SET_LINESTYLE 14
#define   IDC_SET_NOTE_COLOR 15
#define   IDB_BOTTON_1 101
#define   IDB_SET_TIME_SHOW  16
#define   IDB_SET_TIME_TEXT_COLOR 17

#define   IDC_BUTTON_CANNAL  18
//#define   IDC_ABOUT 8
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DataShow.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CDataShow window
struct  pdc
{		
	CBrush new_brush,*old_brush;
	CPen new_pen,*old_pen;
	COLORREF c;
};
class CDataShow : public CStatic
{
// Construction
public:
	CDataShow();
// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDataShow)
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetTimeShow(bool IsShow);
	void SetTimeTextColor(COLORREF C);
	CString GetTimeFormat();
	void SetNoteColor(COLORREF C);
	void SetNoteWordOn(bool IsOn);
	void SetNoteText(CString note);
	void Draw_NoteWord(CDC *pDC);
	
	void TextControl(CDC *pDC);
	void Draw_Text(CDC*pDC,CString str);
	void EnlargeSelectLarge();
	void SetSelectRectColor(COLORREF C);
	void Draw_SelectArea(CDC*pDC);
	void Move(CPoint p);
	
	
	void Init();
	///////////////////////////颜色设置
	void SetTitleColor(COLORREF C);//设置标题颜色
	void SetCrossColor(COLORREF C);//设置十字线颜色
	void SetTextColor(COLORREF C);//设置文字颜色
	void SetDataColor(COLORREF C);//设置曲线颜色

	void SetChildRectColor(COLORREF C);//设置数据窗口颜色
	void SetFrameColor(COLORREF C);//设置背景框颜色
	int SetDrawLineStyle(int style,int lineWide);//设置数据绘制样式,style为线形,其值为0到6,linewide为线宽,其值为0到20.
	void SetXYLebalColor(COLORREF C);//设置x,y坐标文颜色。
	void SetAxisColor(COLORREF C);//设置坐标轴颜色
//////////////////////////
	void SetGridDensity(int density);//设置网格密度,其值大于0
	void Grid(CString IsOn);//控制网格开关,grid:on,off.
		void SetGridColor(COLORREF C);//设置网格颜色
//////////////////////////

	void SetAxisRange(double start,double ed,CString name);//坐标轴范围设置,用于确定最大最小坐标刻度,name:x,y分别表示设置x轴和y轴。
	void SetData(double *x,double *y,int n);//设置显示数据,n为数据的大小。
	void SetMaxCapturePicture(int max_p);//暂时不可用
	void CaptureSaveBMP(CString filename);//保存当前图像
	void SaveData();//保存数据,调用时自动弹出保存对话框
	void LoadData();//载入数据,调用时自动弹出对话框
	bool SaveBmp();	//保存当前图片,调用时自动弹出对话框
	void SaveData(double second,bool stop);//连续保存数据,second为间隔秒数,stop控制是否停止,stop为true时停止。
	void SaveBmp(double second,bool stop);//连续图像,second为间隔秒数,stop控制是否停止,stop为true时停止。
	void SetText(CString str,CString name="x");//设置坐标轴及标题文字,name为x,y,title时相应设置其值。
	

virtual ~CDataShow();

	// Generated message map functions
protected:
	//{{AFX_MSG(CDataShow)
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnPaint();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnSaveBmp();
	afx_msg void OnSaveData();
	afx_msg void OnSetDataColor();
    afx_msg void OnSetAxisColor();
	afx_msg void OnSetXYlebalColor();
	afx_msg void OnSetGridColor();
	afx_msg void OnSetBKColor();
	afx_msg void OnSetTitleColor();
	afx_msg void OnSetCrossLineColor();
	afx_msg void OnSetFaceColor();
	afx_msg void OnSetDataInput();
	afx_msg void OnSetGridOnOff();
    afx_msg void OnSetNoteOnOff();
    afx_msg void OnSetNoteColor();
	afx_msg void OnSetTimeShow();
    afx_msg void OnSetTimeColor();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
private:

	void SetNotePoint();
	void SetColor(CString name);
	void Enlarge(CPoint p);
	void DataChange(CString name);//数据转换,用于输入数据的显示name可为:in(显示),out(输出)
	void SaveDateAuto();
	void SaveBmpWithTheOfTime();
	void Draw_SelectRect(CDC *pdc);
	void SetAxisChange();
	void Draw_Grid(CDC *pDC);
	double GetDistance(CPoint p,double x,double y);
	void Draw_childRect(CDC *dc);
	void Draw_frameRect(CDC *dc);
	double GetAxisPosition(int n,CString name);//获得坐标刻度值
	void Draw_Data(CDC*pDC);
	void Draw_Axis_xyLebal(CDC *pdc);
	bool IsDataOut(double x,double y);
	void Draw_CrossLine(CDC*pDC);
	void SetTitlePosition();
	void Draw_Axis(CDC*pDC);
	void Draw_Title(CDC *pdc);
	void Draw_MousePoint(CDC *pdc);
	int GetNearPoint();
	void SetDataRect();
	void SetNearMousePoint();
	
	int m_max_CapturePictre,m_captureNum;
	double m_yFactor;
	double m_xFactor;
	int m_GridControl;
	BOOL m_bIsGridOn;
	pdc m_pdc_framRect,m_pdc_childRect,m_pdc_data,m_pdc_axis
		,m_axis_xyLebal,m_pdc_grid;
	CRect m_dataRect;
	CRect m_frameRect;
	CPoint m_pTextPosition,m_start_POINT,m_end_point;
	CPoint m_pOrth;
	CPoint m_pMousePoint;
	int x,m_numOfBMP,m_numofData;
	double w,h;
	double m_x_start,m_x_end,m_y_start,m_y_end;
	int m_High,m_Low,m_dNum,m_Top,m_Bottom,m_dnum_top_bottom,m_lineWide;
	float m_Data_x[2000];
	float m_Data_y[2000];
	int m_dNumOfData;
	bool m_IsCrossMove,m_IsMove;
	CPoint m_move_formerpoint,m_enlarge_point;
	CPoint m_Select_Enlarge_p1,m_Select_Enlarge_p2,m_pNote_point,m_timeShow_point;
	
	COLORREF text_color,m_cross_color,title_color,m_selectRect_color,m_datacolor,m_SelectRect_Color,m_color_note,m_time_color;
	
	CString m_sAxis_xstr,m_sAxis_ystr,m_sTitle_str,m_sNote_text;
	bool m_IsCaptureSaveBMP,m_IsEnlarge,m_IsSelect_enlarge,m_IsEnlargeClose,m_IsNoteOn,m_IsTimeShow;
	int m_lineStyle;
	
	////////////////////
	int m_numOf_Text;
	CPoint m_text_point[20];
	CString m_Text[20];

};

/////////////////////////////////////////////////////////////////////////////

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

#endif // !defined(AFX_DATASHOW_H__50A0E545_1AFF_4752_9317_5ACBACA5073D__INCLUDED_)

⌨️ 快捷键说明

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