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

📄 roundsliderctrl.h

📁 一个很好的虚拟示波器!可一直接运行!他通过串口采集信号与系统单片机上的数据
💻 H
字号:
// RoundSliderCtrl.h : Header file
//
// Copyright (c) 2002 魏巍所有
// 参见 RoundSliderCtrl.cpp 的详细注解

#if !defined(_ROUNDSLIDERCTRL_H_)
#define _ROUNDSLIDERCTRL_H_

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

class CRoundSliderCtrl : public CSliderCtrl
{
protected:
	CPoint		m_ptCenter;
	CPoint		m_ptKnobCenter;
	int			m_nRadius;
	CRgn		m_rgn;

	int			m_nZero;
	bool		m_bInverted;

	CString		m_strText;
	int			m_nKnobRadius;			//指示器半径

	bool		m_bDragging;			//鼠标左键是否已经按下
	bool		m_bDragByKnobOnly;
	bool		m_bDragChanged;			//指示器是否改变标志
	bool        m_bBitmap;              //是否用位图标志

	LOGFONT		m_lf;
	CFont		m_font;
	COLORREF	m_crText;
	HBRUSH		m_hKnobBrush;			//无热点时的指针颜色
	HBRUSH      m_hActiveKnobBrush;     //鼠标按下时的指针颜色
	HBRUSH		m_hDialBrush;			//当无位图时的滑块背景颜色

	int         m_nMax, m_nMin;			//最大/最小 域
	UINT		m_uiBitID;				//位图ID标识
	BOOL		m_bShowText;

	HCURSOR     m_hcCross;

public:
	DECLARE_DYNAMIC(CRoundSliderCtrl)

	CRoundSliderCtrl();
	virtual ~CRoundSliderCtrl();

	
	virtual void SetText(const CString& strNewText);
	virtual CString GetText() const;

	
	virtual void SetKnobRadius(const int nNewKnobRadius);
	virtual int GetKnobRadius() const;

	virtual void SetDragByKnobOnly(const bool bDragByKnobOnly);
	virtual bool GetDragByKnobOnly() const;

	
	virtual void SetZero(const int nZero);
	virtual int GetZero() const;

	
	virtual void SetInverted(const bool bNewInverted = true);
	virtual bool GetInverted() const;

	virtual void SetDialColor(const COLORREF crBkgnd);
	virtual void SetKnobColor(const COLORREF crBkgnd);
	virtual void SetTextColor(const COLORREF crText);
	virtual void SetActiveKnobColor( const COLORREF crBkgnd );

	virtual void SetFontBold(const bool bSet = true);
	virtual void SetFontUnderline(const bool bSet = true);
	virtual void SetFontItalic(const bool bSet = true);
	virtual void SetFontSize(const int nSize);
	virtual void SetFontName(const CString& strFont);
	void SetShowText( const BOOL bShow = TRUE );
	
	void SetRange( int nMin, int nMax, BOOL bRedraw );
	void GetRange( int &nMin, int &nMax );

	void SetBitmap( UINT uNewBitID );

protected:
	// Override this function for customized output
	virtual CString OnFormatText() const;

	//{{AFX_VIRTUAL(CRoundSliderCtrl)
	protected:
	virtual void PreSubclassWindow();
	//}}AFX_VIRTUAL

protected:
	virtual void ReconstructFont();

	virtual void Init();
	virtual bool SetKnob(const CPoint& pt);
	virtual void PostMessageToParent(const int nTBCode) const;

	//{{AFX_MSG(CRoundSliderCtrl)
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

#ifdef _DEBUG
public:
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif // _DEBUG
};

//{{AFX_INSERT_LOCATION}}

#endif // _ROUNDSLIDERCTRL_H_

⌨️ 快捷键说明

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