AnalogMeter.h
上传用户:haifei
上传日期:2022-07-20
资源大小:77k
文件大小:3k
源码类别:

网络编程

开发平台:

Visual C++

  1. #if !defined(AFX_ANALOGMETER_H__7B6C2C14_9681_11D2_9136_0020AF9FE21E__INCLUDED_)
  2. #define AFX_ANALOGMETER_H__7B6C2C14_9681_11D2_9136_0020AF9FE21E__INCLUDED_
  3. #if _MSC_VER >= 1000
  4. #pragma once
  5. #endif // _MSC_VER >= 1000
  6. // AnalogMeter.h : header file
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CAnalogMeter command target
  10. class CAnalogMeter : public CCmdTarget
  11. {
  12. DECLARE_DYNCREATE(CAnalogMeter)
  13. CAnalogMeter() ;
  14. virtual ~CAnalogMeter();
  15. // Attributes
  16. public:
  17. COLORREF m_colorGrid;
  18. COLORREF m_colorNeedle;
  19. COLORREF m_colorValue;
  20. double m_dMinScale; 
  21. double m_dMaxScale;
  22. // Operations
  23. public:
  24. double m_dPercent;  // 当前指针的百分比
  25. void ShowMeter(CDC *pDC, CRect rectBorder);
  26. void UpdateNeedle(CDC *pDC, double dPos);
  27. void SetRange (double dMin, double dMax);
  28. void SetRangeDecimals(int nRangeDecimals);
  29. void SetValueDecimals(int nValueDecimals);
  30. void SetTitle(CString strTitle);
  31. double GetMaxRange()   {return m_dMaxScale; } ;
  32. double GetMinRange()   {return m_dMinScale; } ;
  33. int GetRangeDecimals() {return m_nRangeDecimals; } ;
  34. int GetValueDecimals() {return m_nValueDecimals; } ;
  35. CString GetTitle()     {return m_strTitle; } ;
  36. // Overrides
  37. // ClassWizard generated virtual function overrides
  38. //{{AFX_VIRTUAL(CAnalogMeter)
  39. //}}AFX_VIRTUAL
  40. // Implementation
  41. protected:
  42. void DrawGrid ();      // 画标尺
  43. void DrawNeedle();     // 画指针   
  44. void ShowMeterImage(CDC *pDC);//显示整幅图 
  45. bool m_boolUseBitmaps ;
  46. bool m_boolForceRedraw;
  47. int m_nRangeDecimals;  // 范围值的小数点位数
  48. int m_nValueDecimals;  // 当前值的小数点位数
  49. int m_nRectWidth;
  50. int m_nRectHeight;
  51. int m_nCXPix;          // 指针中心(x,y)坐标   
  52. int m_nCYPix;          // 
  53. int m_nRadiusPix;      // 半径
  54. int m_nLeftLimitXPix;
  55. int m_nLeftLimitYPix;
  56. int m_nRightLimitXPix;
  57. int m_nRightLimitYPix;
  58. int m_nHalfBaseWidth;
  59. int m_nTextBaseSpacing;
  60. double m_dPI;              // 180度的弧度值
  61. double m_dLimitAngleRad;  
  62. double m_dRadiansPerValue; // m_dMaxScale-m_dMinScale范围内每个刻度的弧度值
  63. double m_dNeedlePos;       // 指针的当前位置
  64. CString m_strTitle;
  65. CDC m_dcGrid;
  66. CBitmap m_bitmapGrid;
  67. CBitmap *m_pbitmapOldGrid;
  68. CDC m_dcNeedle ;
  69. CBitmap m_bitmapNeedle;
  70. CBitmap *m_pbitmapOldNeedle;
  71. CRect m_rectDraw;
  72. CRect m_rectOwner;
  73. CRect m_rectMinValue;
  74. CRect m_rectMaxValue;
  75. CRect m_rectValue;
  76. CFont m_fontValue;
  77. CBrush m_brushErase;
  78. CPen m_penErase;
  79. // Generated message map functions
  80. //{{AFX_MSG(CAnalogMeter)
  81. // NOTE - the ClassWizard will add and remove member functions here.
  82. //}}AFX_MSG
  83. DECLARE_MESSAGE_MAP()
  84. };
  85. /////////////////////////////////////////////////////////////////////////////
  86. //{{AFX_INSERT_LOCATION}}
  87. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  88. #endif // !defined(AFX_ANALOGMETER_H__7B6C2C14_9681_11D2_9136_0020AF9FE21E__INCLUDED_)