home *** CD-ROM | disk | FTP | other *** search
/ Master Visual C++ 1.5 / MASTERVC15.ISO / vcprog / original / ch31 / mygraph / mygravw.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-09  |  8.0 KB  |  407 lines

  1. // mygravw.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "mygraph.h"
  6. #include "mygravw.h"
  7.  
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char BASED_CODE THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CMygraphView
  15.  
  16. IMPLEMENT_DYNCREATE(CMygraphView, CFormView)
  17.  
  18. CMygraphView::CMygraphView()
  19.     : CFormView(CMygraphView::IDD)
  20. {
  21.     //{{AFX_DATA_INIT(CMygraphView)
  22.     m_graph = NULL;
  23.     //}}AFX_DATA_INIT
  24. }
  25.  
  26. CMygraphView::~CMygraphView()
  27. {
  28. }
  29.  
  30. void CMygraphView::DoDataExchange(CDataExchange* pDX)
  31. {
  32.     CFormView::DoDataExchange(pDX);
  33.     //{{AFX_DATA_MAP(CMygraphView)
  34.     DDX_VBControl(pDX, IDC_GRAPH1, m_graph);
  35.     //}}AFX_DATA_MAP
  36. }
  37.  
  38.  
  39. BEGIN_MESSAGE_MAP(CMygraphView, CFormView)
  40.     //{{AFX_MSG_MAP(CMygraphView)
  41.     ON_BN_CLICKED(IDC_SECOND_BUTTON, OnSecondButton)
  42.     ON_BN_CLICKED(IDC_PRINT_BUTTON, OnPrintButton)
  43.     ON_BN_CLICKED(IDC_BUTTON_1, OnButton1)
  44.     ON_BN_CLICKED(IDC_BUTTON_2, OnButton2)
  45.     ON_BN_CLICKED(IDC_BUTTON_3, OnButton3)
  46.     ON_BN_CLICKED(IDC_BUTTON_4, OnButton4)
  47.     ON_BN_CLICKED(IDC_BUTTON_5, OnButton5)
  48.     ON_BN_CLICKED(IDC_BUTTON_6, OnButton6)
  49.     ON_BN_CLICKED(IDC_BUTTON_7, OnButton7)
  50.     ON_BN_CLICKED(IDC_BUTTON_8, OnButton8)
  51.     ON_BN_CLICKED(IDC_BUTTON_9, OnButton9)
  52.     ON_BN_CLICKED(IDC_BUTTON_10, OnButton10)
  53.     ON_VBXEVENT(VBN_CLICK, IDC_GRAPH1, OnClickGraph1)
  54.     //}}AFX_MSG_MAP
  55. END_MESSAGE_MAP()
  56.  
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59. // CMygraphView message handlers
  60.  
  61.  
  62. //////////////////////
  63. // MY CODE STARTS HERE
  64. //////////////////////
  65.  
  66. void CMygraphView::OnInitialUpdate()
  67. {
  68.  
  69.       // Call the base class function.
  70.       CFormView::OnInitialUpdate();
  71.  
  72.  
  73.     // Set the current point to 1
  74.     m_graph->SetNumProperty("ThisPoint",1);
  75.     // Set the current data to 10.
  76.     m_graph->SetFloatProperty("GraphData",10);
  77.  
  78.  
  79.     // Set the current point to 2
  80.     m_graph->SetNumProperty("ThisPoint",2);
  81.     // Set the current data to 8.
  82.     m_graph->SetFloatProperty("GraphData",8);
  83.  
  84.  
  85.     // Set the current point to 3
  86.     m_graph->SetNumProperty("ThisPoint",3);
  87.     // Set the current data to 6.
  88.     m_graph->SetFloatProperty("GraphData",6);
  89.  
  90.  
  91.     // Set the current point to 4
  92.     m_graph->SetNumProperty("ThisPoint",4);
  93.     // Set the current data to 4.
  94.     m_graph->SetFloatProperty("GraphData",4);
  95.  
  96.  
  97.     // Set the current point to 5
  98.     m_graph->SetNumProperty("ThisPoint",5);
  99.     // Set the current data to 2.
  100.     m_graph->SetFloatProperty("GraphData",2);
  101.  
  102. }
  103.  
  104. ////////////////////
  105. // MY CODE ENDS HERE
  106. ////////////////////
  107.  
  108. void CMygraphView::OnSecondButton()
  109. {
  110.     // TODO: Add your control notification handler code here
  111.  
  112.     //////////////////////
  113.     // MY CODE STARTS HERE
  114.     //////////////////////
  115.  
  116.     // Set the NumSets property to 2
  117.     m_graph->SetNumProperty("NumSets",2);
  118.  
  119.     // Set the ThisSet property to 2
  120.     m_graph->SetNumProperty("ThisSet",2);
  121.  
  122.     // Set the NumPoints property to 5
  123.     m_graph->SetNumProperty("NumPoints",5);
  124.  
  125.     // Set the current point to 1
  126.     m_graph->SetNumProperty("ThisPoint",1);
  127.     // Set the current data to 2.
  128.     m_graph->SetFloatProperty("GraphData",2);
  129.  
  130.  
  131.     // Set the current point to 2
  132.     m_graph->SetNumProperty("ThisPoint",2);
  133.     // Set the current data to 4.
  134.     m_graph->SetFloatProperty("GraphData",4);
  135.  
  136.  
  137.     // Set the current point to 3
  138.     m_graph->SetNumProperty("ThisPoint",3);
  139.     // Set the current data to 6.
  140.     m_graph->SetFloatProperty("GraphData",6);
  141.  
  142.  
  143.     // Set the current point to 4
  144.     m_graph->SetNumProperty("ThisPoint",4);
  145.     // Set the current data to 8.
  146.     m_graph->SetFloatProperty("GraphData",8);
  147.  
  148.  
  149.     // Set the current point to 5
  150.     m_graph->SetNumProperty("ThisPoint",5);
  151.     // Set the current data to 10.
  152.     m_graph->SetFloatProperty("GraphData",10);
  153.  
  154.  
  155.     // Draw it
  156.     m_graph->SetNumProperty("DrawMode",2);
  157.  
  158.     ////////////////////
  159.     // MY CODE ENDS HERE
  160.     ////////////////////
  161.     
  162. }
  163.  
  164. void CMygraphView::OnPrintButton()
  165. {
  166.     // TODO: Add your control notification handler code here
  167.     
  168.  
  169.     //////////////////////
  170.     // MY CODE STARTS HERE
  171.     //////////////////////
  172.  
  173.     m_graph->SetNumProperty("DrawMode",5);
  174.  
  175.     ////////////////////
  176.     // MY CODE ENDS HERE
  177.     ////////////////////
  178.  
  179.  
  180.  
  181. }
  182.  
  183. void CMygraphView::OnButton1()
  184. {
  185.     // TODO: Add your control notification handler code here
  186.  
  187.     //////////////////////
  188.     // MY CODE STARTS HERE
  189.     //////////////////////
  190.  
  191.     m_graph->SetNumProperty("GraphType",1);
  192.  
  193.    // Draw it
  194.     m_graph->SetNumProperty("DrawMode",2);
  195.  
  196.     ////////////////////
  197.     // MY CODE ENDS HERE
  198.     ////////////////////
  199. }
  200.  
  201. void CMygraphView::OnButton2()
  202. {
  203.     // TODO: Add your control notification handler code here
  204.  
  205.     //////////////////////
  206.     // MY CODE STARTS HERE
  207.     //////////////////////
  208.  
  209.     m_graph->SetNumProperty("GraphType",2);
  210.  
  211.     // Draw it
  212.     m_graph->SetNumProperty("DrawMode",2);
  213.  
  214.  
  215.     ////////////////////
  216.     // MY CODE ENDS HERE
  217.     ////////////////////
  218.  
  219.     
  220. }
  221.  
  222. void CMygraphView::OnButton3()
  223. {
  224.     // TODO: Add your control notification handler code here
  225.  
  226.     //////////////////////
  227.     // MY CODE STARTS HERE
  228.     //////////////////////
  229.  
  230.     m_graph->SetNumProperty("GraphType",3);
  231.  
  232.    // Draw it
  233.     m_graph->SetNumProperty("DrawMode",2);
  234.  
  235.  
  236.     ////////////////////
  237.     // MY CODE ENDS HERE
  238.     ////////////////////
  239.     
  240. }
  241.  
  242. void CMygraphView::OnButton4()
  243. {
  244.     // TODO: Add your control notification handler code here
  245.  
  246.     //////////////////////
  247.     // MY CODE STARTS HERE
  248.     //////////////////////
  249.  
  250.     m_graph->SetNumProperty("GraphType",4);
  251.  
  252.    // Draw it
  253.     m_graph->SetNumProperty("DrawMode",2);
  254.  
  255.  
  256.     ////////////////////
  257.     // MY CODE ENDS HERE
  258.     ////////////////////
  259.  
  260.     
  261. }
  262.  
  263. void CMygraphView::OnButton5()
  264. {
  265.     // TODO: Add your control notification handler code here
  266.  
  267.  
  268.     //////////////////////
  269.     // MY CODE STARTS HERE
  270.     //////////////////////
  271.  
  272.     m_graph->SetNumProperty("GraphType",5);
  273.  
  274.     // Draw it
  275.     m_graph->SetNumProperty("DrawMode",2);
  276.  
  277.  
  278.     ////////////////////
  279.     // MY CODE ENDS HERE
  280.     ////////////////////
  281.     
  282. }
  283.  
  284. void CMygraphView::OnButton6()
  285. {
  286.     // TODO: Add your control notification handler code here
  287.  
  288.  
  289.     //////////////////////
  290.     // MY CODE STARTS HERE
  291.     //////////////////////
  292.  
  293.     m_graph->SetNumProperty("GraphType",6);
  294.  
  295.     // Draw it
  296.     m_graph->SetNumProperty("DrawMode",2);
  297.  
  298.  
  299.     ////////////////////
  300.     // MY CODE ENDS HERE
  301.     ////////////////////
  302.     
  303. }
  304.  
  305. void CMygraphView::OnButton7()
  306. {
  307.     // TODO: Add your control notification handler code here
  308.  
  309.  
  310.     //////////////////////
  311.     // MY CODE STARTS HERE
  312.     //////////////////////
  313.  
  314.     m_graph->SetNumProperty("GraphType",7);
  315.  
  316.     // Draw it
  317.     m_graph->SetNumProperty("DrawMode",2);
  318.  
  319.  
  320.     ////////////////////
  321.     // MY CODE ENDS HERE
  322.     ////////////////////
  323.     
  324. }
  325.  
  326. void CMygraphView::OnButton8()
  327. {
  328.     // TODO: Add your control notification handler code here
  329.  
  330.  
  331.     //////////////////////
  332.     // MY CODE STARTS HERE
  333.     //////////////////////
  334.  
  335.     m_graph->SetNumProperty("GraphType",8);
  336.  
  337.     // Draw it
  338.     m_graph->SetNumProperty("DrawMode",2);
  339.  
  340.  
  341.     ////////////////////
  342.     // MY CODE ENDS HERE
  343.     ////////////////////
  344.     
  345. }
  346.  
  347. void CMygraphView::OnButton9()
  348. {
  349.     // TODO: Add your control notification handler code here
  350.  
  351.     //////////////////////
  352.     // MY CODE STARTS HERE
  353.     //////////////////////
  354.  
  355.     m_graph->SetNumProperty("GraphType",9);
  356.  
  357.     // Draw it
  358.     m_graph->SetNumProperty("DrawMode",2);
  359.  
  360.  
  361.     ////////////////////
  362.     // MY CODE ENDS HERE
  363.     ////////////////////
  364.  
  365.     
  366. }
  367.  
  368. void CMygraphView::OnButton10()
  369. {
  370.     // TODO: Add your control notification handler code here
  371.     
  372.     //////////////////////
  373.     // MY CODE STARTS HERE
  374.     //////////////////////
  375.  
  376.     m_graph->SetNumProperty("GraphType",10);
  377.  
  378.    // Draw it
  379.     m_graph->SetNumProperty("DrawMode",2);
  380.  
  381.  
  382.     ////////////////////
  383.     // MY CODE ENDS HERE
  384.     ////////////////////
  385.  
  386. }
  387.  
  388. void CMygraphView::OnClickGraph1(UINT, int, CWnd*, LPVOID)
  389. {
  390.     // TODO: Add your VBX event notification handler code here
  391.  
  392.     //////////////////////
  393.     // MY CODE STARTS HERE
  394.     //////////////////////
  395.  
  396.  
  397.     // Clear the graph
  398.     m_graph->SetNumProperty("DrawMode",1);
  399.  
  400.  
  401.     ////////////////////
  402.     // MY CODE ENDS HERE
  403.     ////////////////////
  404.  
  405.     
  406. }
  407.